Added add_segment() method to IETF attributes
[strongswan.git] / src / libimcv / imv / imv_state.h
1 /*
2 * Copyright (C) 2011-2014 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 *
18 * @defgroup imv_state_t imv_state
19 * @{ @ingroup libimcv_imv
20 */
21
22 #ifndef IMV_STATE_H_
23 #define IMV_STATE_H_
24
25 #include "imv_session.h"
26 #include "seg/seg_contract_manager.h"
27
28 #include <tncifimv.h>
29
30 #include <library.h>
31
32 typedef struct imv_state_t imv_state_t;
33
34 /**
35 * Internal state of an IMV connection instance
36 */
37 struct imv_state_t {
38
39 /**
40 * Get the TNCCS connection ID attached to the state
41 *
42 * @return TNCCS connection ID of the state
43 */
44 TNC_ConnectionID (*get_connection_id)(imv_state_t *this);
45
46 /**
47 * Checks if long message types are supported for this TNCCS connection
48 *
49 * @return TRUE if set, FALSE otherwise
50 */
51 bool (*has_long)(imv_state_t *this);
52
53 /**
54 * Checks if the exclusive delivery is supported for this TNCCS connection
55 *
56 * @return TRUE if set, FALSE otherwise
57 */
58 bool (*has_excl)(imv_state_t *this);
59
60 /**
61 * Sets the long message types and exclusive flags for this TNCCS connection
62 *
63 * @param has_long TNCCS connection supports long message types
64 * @param has_excl TNCCS connection supports exclusive delivery
65 * @return TRUE if set, FALSE otherwise
66 */
67 void (*set_flags)(imv_state_t *this, bool has_long, bool has_excl);
68
69 /**
70 * Set the maximum size of a PA-TNC message for this TNCCS connection
71 *
72 * @param max_msg_len maximum size of a PA-TNC message
73 */
74 void (*set_max_msg_len)(imv_state_t *this, uint32_t max_msg_len);
75
76 /**
77 * Get the maximum size of a PA-TNC message for this TNCCS connection
78 *
79 * @return maximum size of a PA-TNC message
80 */
81 uint32_t (*get_max_msg_len)(imv_state_t *this);
82
83 /**
84 * Set flags for completed actions
85 *
86 * @param flags Flags to be set
87 */
88 void (*set_action_flags)(imv_state_t *this, uint32_t flags);
89
90 /**
91 * Get flags set for completed actions
92 *
93 * @return Flags set for completed actions
94 */
95 uint32_t (*get_action_flags)(imv_state_t *this);
96
97 /**
98 * Set session associated with TNCCS Connection
99 *
100 * @param session Session associated with TNCCS Connection
101 */
102 void (*set_session)(imv_state_t *this, imv_session_t *session);
103
104 /**
105 * Get session associated with TNCCS Connection
106 *
107 * @return Session associated with TNCCS Connection
108 */
109 imv_session_t* (*get_session)(imv_state_t *this);
110
111 /**
112 * Get attribute segmentation contracts associated with TNCCS Connection
113 *
114 * @return Contracts associated with TNCCS Connection
115 */
116 seg_contract_manager_t* (*get_contracts)(imv_state_t *this);
117
118 /**
119 * Change the connection state
120 *
121 * @param new_state new connection state
122 */
123 void (*change_state)(imv_state_t *this, TNC_ConnectionState new_state);
124
125 /**
126 * Get IMV action recommendation and evaluation result
127 *
128 * @param rec IMV action recommendation
129 * @param eval IMV evaluation result
130 *
131 */
132 void (*get_recommendation)(imv_state_t *this,
133 TNC_IMV_Action_Recommendation *rec,
134 TNC_IMV_Evaluation_Result *eval);
135
136 /**
137 * Set IMV action recommendation and evaluation result
138 *
139 * @param rec IMV action recommendation
140 * @param eval IMV evaluation result
141 *
142 */
143 void (*set_recommendation)(imv_state_t *this,
144 TNC_IMV_Action_Recommendation rec,
145 TNC_IMV_Evaluation_Result eval);
146
147 /**
148 * Update IMV action recommendation and evaluation result
149 *
150 * @param rec IMV action recommendation
151 * @param eval IMV evaluation result
152 *
153 */
154 void (*update_recommendation)(imv_state_t *this,
155 TNC_IMV_Action_Recommendation rec,
156 TNC_IMV_Evaluation_Result eval);
157
158 /**
159 * Get reason string based on the preferred language
160 *
161 * @param language_enumerator language enumerator
162 * @param reason_string reason string
163 * @param reason_language language of the returned reason string
164 * @return TRUE if a reason string was found
165 */
166 bool (*get_reason_string)(imv_state_t *this,
167 enumerator_t *language_enumerator,
168 chunk_t *reason_string, char **reason_language);
169
170 /**
171 * Get remediation instructions based on the preferred language
172 *
173 * @param language_enumerator language enumerator
174 * @param string remediation instruction string
175 * @param lang_code language of the remediation instructions
176 * @param uri remediation URI
177 * @return TRUE if remediation instructions were found
178 */
179 bool (*get_remediation_instructions)(imv_state_t *this,
180 enumerator_t *language_enumerator,
181 chunk_t *string, char **lang_code,
182 char **uri);
183
184 /**
185 * Destroys an imv_state_t object
186 */
187 void (*destroy)(imv_state_t *this);
188 };
189
190 #endif /** IMV_STATE_H_ @}*/