2 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * @defgroup imv_agent_t imv_agent
18 * @{ @ingroup imv_agent
24 #include "imv_state.h"
26 #include <tnc/tncifimv.h>
27 #include <tnc/pen/pen.h>
30 typedef struct imv_agent_t imv_agent_t
;
33 * Core functions of an Integrity Measurement Verifier (IMV)
38 * Ask a TNCS to retry an Integrity Check Handshake
40 * @param imv_id IMV ID assigned by TNCS
41 * @param connection_id network connection ID assigned by TNCS
42 * @param reason IMV retry reason
43 * @return TNC result code
45 TNC_Result (*request_handshake_retry
)(TNC_IMVID imv_id
,
46 TNC_ConnectionID connection_id
,
47 TNC_RetryReason reason
);
50 * Get the value of an attribute associated with a connection
51 * or with the TNCS as a whole.
53 * @param imv_id IMV ID assigned by TNCS
54 * @param connection_id network connection ID assigned by TNCS
55 * @param attribute_id attribute ID
56 * @param buffer_len length of buffer in bytes
57 * @param buffer buffer
58 * @param out_value_len size in bytes of attribute stored in buffer
59 * @return TNC result code
61 TNC_Result (*get_attribute
)(TNC_IMVID imv_id
,
62 TNC_ConnectionID connection_id
,
63 TNC_AttributeID attribute_id
,
64 TNC_UInt32 buffer_len
,
65 TNC_BufferReference buffer
,
66 TNC_UInt32
*out_value_len
);
69 * Set the value of an attribute associated with a connection
70 * or with the TNCS as a whole.
72 * @param imv_id IMV ID assigned by TNCS
73 * @param connection_id network connection ID assigned by TNCS
74 * @param attribute_id attribute ID
75 * @param buffer_len length of buffer in bytes
76 * @param buffer buffer
77 * @return TNC result code
79 TNC_Result (*set_attribute
)(TNC_IMVID imv_id
,
80 TNC_ConnectionID connection_id
,
81 TNC_AttributeID attribute_id
,
82 TNC_UInt32 buffer_len
,
83 TNC_BufferReference buffer
);
88 * @param bind_function function offered by the TNCS
89 * @return TNC result code
91 TNC_Result (*bind_functions
)(imv_agent_t
*this,
92 TNC_TNCS_BindFunctionPointer bind_function
);
95 * Create the IMV state for a TNCCS connection instance
97 * @param state internal IMV state instance
98 * @return TNC result code
100 TNC_Result (*create_state
)(imv_agent_t
*this, imv_state_t
*state
);
103 * Delete the IMV state for a TNCCS connection instance
105 * @param connection_id network connection ID assigned by TNCS
106 * @return TNC result code
108 TNC_Result (*delete_state
)(imv_agent_t
*this,
109 TNC_ConnectionID connection_id
);
112 * Change the current state of a TNCCS connection
114 * @param connection_id network connection ID assigned by TNCS
115 * @param new_state new state of TNCCS connection
116 * @return TNC result code
118 TNC_Result (*change_state
)(imv_agent_t
*this,
119 TNC_ConnectionID connection_id
,
120 TNC_ConnectionState new_state
);
123 * Get the IMV state for a TNCCS connection instance
125 * @param connection_id network connection ID assigned by TNCS
126 * @param state internal IMV state instance
127 * @return TRUE if the state was found
129 bool (*get_state
)(imv_agent_t
*this,
130 TNC_ConnectionID connection_id
, imv_state_t
**state
);
133 * Call when an IMV-IMC message is to be sent
135 * @param connection_id network connection ID assigned by TNCS
136 * @param msg message to send
137 * @return TNC result code
139 TNC_Result (*send_message
)(imv_agent_t
*this,
140 TNC_ConnectionID connection_id
, chunk_t msg
);
143 * Set Action Recommendation and Evaluation Result in the IMV state
145 # @param connection_id network connection ID assigned by TNCS
146 * @param rec IMV action recommendation
147 * @param eval IMV evaluation result
148 * @return TNC result code
150 TNC_Result (*set_recommendation
)(imv_agent_t
*this,
151 TNC_ConnectionID connection_id
,
152 TNC_IMV_Action_Recommendation rec
,
153 TNC_IMV_Evaluation_Result eval
);
156 * Deliver IMV Action Recommendation and IMV Evaluation Result to the TNCS
158 # @param connection_id network connection ID assigned by TNCS
159 * @return TNC result code
161 TNC_Result (*provide_recommendation
)(imv_agent_t
*this,
162 TNC_ConnectionID connection_id
);
165 * Destroys an imv_agent_t object
167 void (*destroy
)(imv_agent_t
*this);
171 * Create an imv_agent_t object
173 * @param name name of the IMV
174 * @param vendor_id vendor ID of the IMV
175 * @param subtype message subtype of the IMV
176 * @param id ID of the IMV as assigned by the TNCS
177 * @param actual_version actual version of the IF-IMV API
180 imv_agent_t
*imv_agent_create(const char *name
,
181 pen_t vendor_id
, u_int32_t subtype
,
182 TNC_IMVID id
, TNC_Version
*actual_version
);
184 #endif /** IMV_AGENT_H_ @}*/