2 * Copyright (C) 2011-2012 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
18 * @defgroup imv_agent_t imv_agent
19 * @{ @ingroup imv_agent
25 #include "imv_state.h"
26 #include "pa_tnc/pa_tnc_msg.h"
30 #include <collections/linked_list.h>
34 typedef struct imv_agent_t imv_agent_t
;
37 * Core functions of an Integrity Measurement Verifier (IMV)
42 * Ask a TNCS to retry an Integrity Check Handshake
44 * @param imv_id IMV ID assigned by TNCS
45 * @param connection_id network connection ID assigned by TNCS
46 * @param reason IMV retry reason
47 * @return TNC result code
49 TNC_Result (*request_handshake_retry
)(TNC_IMVID imv_id
,
50 TNC_ConnectionID connection_id
,
51 TNC_RetryReason reason
);
54 * Call when an IMV-IMC message is to be sent
56 * @param imv_id IMV ID assigned by TNCS
57 * @param connection_id network connection ID assigned by TNCS
58 * @param msg message to send
59 * @param msg_len message length in bytes
60 * @param msg_type message type
61 * @return TNC result code
63 TNC_Result (*send_message
)(TNC_IMVID imv_id
,
64 TNC_ConnectionID connection_id
,
65 TNC_BufferReference msg
,
67 TNC_MessageType msg_type
);
70 * Call when an IMV-IMC message is to be sent with long message types
72 * @param imv_id IMV ID assigned by TNCS
73 * @param connection_id network connection ID assigned by TNCS
74 * @param msg_flags message flags
75 * @param msg message to send
76 * @param msg_len message length in bytes
77 * @param msg_vid message vendor ID
78 * @param msg_subtype message subtype
79 * @param dst_imc_id destination IMC ID
80 * @return TNC result code
82 TNC_Result (*send_message_long
)(TNC_IMVID imv_id
,
83 TNC_ConnectionID connection_id
,
85 TNC_BufferReference msg
,
88 TNC_MessageSubtype msg_subtype
,
89 TNC_UInt32 dst_imc_id
);
94 * @param bind_function function offered by the TNCS
95 * @return TNC result code
97 TNC_Result (*bind_functions
)(imv_agent_t
*this,
98 TNC_TNCS_BindFunctionPointer bind_function
);
101 * Create the IMV state for a TNCCS connection instance
103 * @param state internal IMV state instance
104 * @return TNC result code
106 TNC_Result (*create_state
)(imv_agent_t
*this, imv_state_t
*state
);
109 * Delete the IMV state for a TNCCS connection instance
111 * @param connection_id network connection ID assigned by TNCS
112 * @return TNC result code
114 TNC_Result (*delete_state
)(imv_agent_t
*this,
115 TNC_ConnectionID connection_id
);
118 * Change the current state of a TNCCS connection
120 * @param connection_id network connection ID assigned by TNCS
121 * @param new_state new state of TNCCS connection
122 * @param state_p internal IMV state instance [optional argument]
123 * @return TNC result code
125 TNC_Result (*change_state
)(imv_agent_t
*this,
126 TNC_ConnectionID connection_id
,
127 TNC_ConnectionState new_state
,
128 imv_state_t
**state_p
);
131 * Get the IMV state for a TNCCS connection instance
133 * @param connection_id network connection ID assigned by TNCS
134 * @param state internal IMV state instance
135 * @return TRUE if the state was found
137 bool (*get_state
)(imv_agent_t
*this,
138 TNC_ConnectionID connection_id
, imv_state_t
**state
);
145 const char* (*get_name
)(imv_agent_t
*this);
152 TNC_IMVID (*get_id
)(imv_agent_t
*this);
155 * Reserve additional IMV IDs from TNCS
157 * @param count number of additional IMV IDs to be assigned
158 * @return TNC result code
160 TNC_Result (*reserve_additional_ids
)(imv_agent_t
*this, int count
);
163 * Return the number of additional IMV IDs assigned by the TNCS
165 * @return number of additional IMV IDs
167 int (*count_additional_ids
)(imv_agent_t
*this);
170 * Create an enumerator for the additional IMV IDs
172 enumerator_t
* (*create_id_enumerator
)(imv_agent_t
*this);
175 * Create a preferred languages enumerator
177 * @param state of TNCCS connection
179 enumerator_t
* (*create_language_enumerator
)(imv_agent_t
*this,
183 * Deliver IMV Action Recommendation and IMV Evaluation Result to the TNCS
185 * @param state state bound to a connection ID
186 * @return TNC result code
188 TNC_Result (*provide_recommendation
)(imv_agent_t
*this, imv_state_t
* state
);
191 * Destroys an imv_agent_t object
193 void (*destroy
)(imv_agent_t
*this);
197 * Create an imv_agent_t object
199 * @param name name of the IMV
200 * @param supported_types list of message types registered by the IMV
201 * @param type_count number of registered message types
202 * @param id ID of the IMV as assigned by the TNCS
203 * @param actual_version actual version of the IF-IMV API
206 imv_agent_t
*imv_agent_create(const char *name
,
207 pen_type_t
*supported_types
, u_int32_t type_count
,
208 TNC_IMVID id
, TNC_Version
*actual_version
);
210 #endif /** IMV_AGENT_H_ @}*/