nearly completed PA-TNC error handling
[strongswan.git] / src / libimcv / pa_tnc / pa_tnc_msg.h
1 /*
2 * Copyright (C) 2011 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup pa_tnc_msg pa_tnc_msg
18 * @{ @ingroup libimcv
19 */
20
21 #ifndef PA_TNC_MSG_H_
22 #define PA_TNC_MSG_H_
23
24 typedef struct pa_tnc_msg_t pa_tnc_msg_t;
25
26 #define PA_TNC_VERSION 0x01
27
28 #include "pa_tnc_attr.h"
29
30 #include <library.h>
31
32 /**
33 * Interface for the RFC 5792 PA-TNC Posture Attribute protocol.
34 *
35 */
36 struct pa_tnc_msg_t {
37
38 /**
39 * Get the encoding of the PA-TNC message
40 *
41 * @return encoded PA-TNC message
42 */
43 chunk_t (*get_encoding)(pa_tnc_msg_t *this);
44
45 /**
46 * Add a PA-TNC attribute
47 *
48 * @param attr PA-TNC attribute to be addedd
49 */
50 void (*add_attribute)(pa_tnc_msg_t *this, pa_tnc_attr_t* attr);
51
52 /**
53 * Build the PA-TNC message
54 */
55 void (*build)(pa_tnc_msg_t *this);
56
57 /**
58 * Process the PA-TNC message
59 *
60 * @return return processing status
61 */
62 status_t (*process)(pa_tnc_msg_t *this);
63
64 /**
65 * Enumerates over all PA-TNC attributes
66 *
67 * @return return attribute enumerator
68 */
69 enumerator_t* (*create_attribute_enumerator)(pa_tnc_msg_t *this);
70
71 /**
72 * Enumerates over all parsing errors
73 *
74 * @return return error enumerator
75 */
76 enumerator_t* (*create_error_enumerator)(pa_tnc_msg_t *this);
77
78 /**
79 * Destroys a pa_tnc_msg_t object.
80 */
81 void (*destroy)(pa_tnc_msg_t *this);
82 };
83
84 /**
85 * Create an empty PA-TNC message
86 */
87 pa_tnc_msg_t* pa_tnc_msg_create(void);
88
89 /**
90 * Create an unprocessed PA-TNC message from received data
91 *
92 * @param data PA-TNC message data
93 */
94 pa_tnc_msg_t* pa_tnc_msg_create_from_data(chunk_t data);
95
96 #endif /** PA_TNC_MSG_H_ @}*/