Annotation of embedaddon/strongswan/src/libimcv/imv/imv_state.h, revision 1.1.1.1
1.1 misho 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: * @return old connection state
123: */
124: TNC_ConnectionState (*change_state)(imv_state_t *this,
125: TNC_ConnectionState new_state);
126:
127: /**
128: * Get IMV action recommendation and evaluation result
129: *
130: * @param rec IMV action recommendation
131: * @param eval IMV evaluation result
132: *
133: */
134: void (*get_recommendation)(imv_state_t *this,
135: TNC_IMV_Action_Recommendation *rec,
136: TNC_IMV_Evaluation_Result *eval);
137:
138: /**
139: * Set IMV action recommendation and evaluation result
140: *
141: * @param rec IMV action recommendation
142: * @param eval IMV evaluation result
143: *
144: */
145: void (*set_recommendation)(imv_state_t *this,
146: TNC_IMV_Action_Recommendation rec,
147: TNC_IMV_Evaluation_Result eval);
148:
149: /**
150: * Update IMV action recommendation and evaluation result
151: *
152: * @param rec IMV action recommendation
153: * @param eval IMV evaluation result
154: *
155: */
156: void (*update_recommendation)(imv_state_t *this,
157: TNC_IMV_Action_Recommendation rec,
158: TNC_IMV_Evaluation_Result eval);
159:
160: /**
161: * Get reason string based on the preferred language
162: *
163: * @param language_enumerator language enumerator
164: * @param reason_string reason string
165: * @param reason_language language of the returned reason string
166: * @return TRUE if a reason string was found
167: */
168: bool (*get_reason_string)(imv_state_t *this,
169: enumerator_t *language_enumerator,
170: chunk_t *reason_string, char **reason_language);
171:
172: /**
173: * Get remediation instructions based on the preferred language
174: *
175: * @param language_enumerator language enumerator
176: * @param string remediation instruction string
177: * @param lang_code language of the remediation instructions
178: * @param uri remediation URI
179: * @return TRUE if remediation instructions were found
180: */
181: bool (*get_remediation_instructions)(imv_state_t *this,
182: enumerator_t *language_enumerator,
183: chunk_t *string, char **lang_code,
184: char **uri);
185:
186: /**
187: * Resets the state for a new measurement cycle triggered by a SRETRY batch
188: */
189: void (*reset)(imv_state_t *this);
190:
191: /**
192: * Destroys an imv_state_t object
193: */
194: void (*destroy)(imv_state_t *this);
195: };
196:
197: #endif /** IMV_STATE_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>