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"
25 #include "pa_tnc/pa_tnc_msg.h"
29 #include <utils/linked_list.h>
33 typedef struct imv_agent_t imv_agent_t
;
36 * Core functions of an Integrity Measurement Verifier (IMV)
41 * Ask a TNCS to retry an Integrity Check Handshake
43 * @param imv_id IMV ID assigned by TNCS
44 * @param connection_id network connection ID assigned by TNCS
45 * @param reason IMV retry reason
46 * @return TNC result code
48 TNC_Result (*request_handshake_retry
)(TNC_IMVID imv_id
,
49 TNC_ConnectionID connection_id
,
50 TNC_RetryReason reason
);
55 * @param bind_function function offered by the TNCS
56 * @return TNC result code
58 TNC_Result (*bind_functions
)(imv_agent_t
*this,
59 TNC_TNCS_BindFunctionPointer bind_function
);
62 * Create the IMV state for a TNCCS connection instance
64 * @param state internal IMV state instance
65 * @return TNC result code
67 TNC_Result (*create_state
)(imv_agent_t
*this, imv_state_t
*state
);
70 * Delete the IMV state for a TNCCS connection instance
72 * @param connection_id network connection ID assigned by TNCS
73 * @return TNC result code
75 TNC_Result (*delete_state
)(imv_agent_t
*this,
76 TNC_ConnectionID connection_id
);
79 * Change the current state of a TNCCS connection
81 * @param connection_id network connection ID assigned by TNCS
82 * @param new_state new state of TNCCS connection
83 * @param state_p internal IMV state instance [optional argument]
84 * @return TNC result code
86 TNC_Result (*change_state
)(imv_agent_t
*this,
87 TNC_ConnectionID connection_id
,
88 TNC_ConnectionState new_state
,
89 imv_state_t
**state_p
);
92 * Get the IMV state for a TNCCS connection instance
94 * @param connection_id network connection ID assigned by TNCS
95 * @param state internal IMV state instance
96 * @return TRUE if the state was found
98 bool (*get_state
)(imv_agent_t
*this,
99 TNC_ConnectionID connection_id
, imv_state_t
**state
);
102 * Call when a PA-TNC message is to be sent
104 * @param connection_id network connection ID assigned by TNCS
105 * @param excl exclusive flag
106 * @param src_imv_id IMV ID to be set as source
107 * @param dst_imc_id IMD ID to be set as destination
108 * @param attr_list list of PA-TNC attributes to send
109 * @return TNC result code
111 TNC_Result (*send_message
)(imv_agent_t
*this,
112 TNC_ConnectionID connection_id
, bool excl
,
113 TNC_UInt32 src_imv_id
, TNC_UInt32 dst_imc_id
,
114 linked_list_t
*attr_list
);
117 * Call when a PA-TNC message was received
119 * @param state state for current connection
120 * @param msg received unparsed message
121 * @param msg_vid message vendorID of the received message
122 * @param msg_subtype message subtype of the received message
123 * @param src_imc_id source IMC ID
124 * @param dst_imv_id destination IMV ID
125 * @param pa_tnc_message parsed PA-TNC message or NULL if an error occurred
126 * @return TNC result code
128 TNC_Result (*receive_message
)(imv_agent_t
*this,
129 imv_state_t
*state
, chunk_t msg
,
130 TNC_VendorID msg_vid
,
131 TNC_MessageSubtype msg_subtype
,
132 TNC_UInt32 src_imc_id
,
133 TNC_UInt32 dst_imv_id
,
134 pa_tnc_msg_t
**pa_tnc_msg
);
137 * Set Action Recommendation and Evaluation Result in the IMV state
139 * @param connection_id network connection ID assigned by TNCS
140 * @param rec IMV action recommendation
141 * @param eval IMV evaluation result
142 * @return TNC result code
144 TNC_Result (*set_recommendation
)(imv_agent_t
*this,
145 TNC_ConnectionID connection_id
,
146 TNC_IMV_Action_Recommendation rec
,
147 TNC_IMV_Evaluation_Result eval
);
150 * Deliver IMV Action Recommendation and IMV Evaluation Result to the TNCS
152 * @param connection_id network connection ID assigned by TNCS
153 * @return TNC result code
155 TNC_Result (*provide_recommendation
)(imv_agent_t
*this,
156 TNC_ConnectionID connection_id
);
159 * Reserve additional IMV IDs from TNCS
161 * @param count number of additional IMV IDs to be assigned
162 * @return TNC result code
164 TNC_Result (*reserve_additional_ids
)(imv_agent_t
*this, int count
);
167 * Return the number of additional IMV IDs assigned by the TNCS
169 * @return number of additional IMV IDs
171 int (*count_additional_ids
)(imv_agent_t
*this);
174 * Create an enumerator for the additional IMV IDs
176 enumerator_t
* (*create_id_enumerator
)(imv_agent_t
*this);
179 * Destroys an imv_agent_t object
181 void (*destroy
)(imv_agent_t
*this);
185 * Create an imv_agent_t object
187 * @param name name of the IMV
188 * @param vendor_id vendor ID of the IMV
189 * @param subtype message subtype of the IMV
190 * @param id ID of the IMV as assigned by the TNCS
191 * @param actual_version actual version of the IF-IMV API
194 imv_agent_t
*imv_agent_create(const char *name
,
195 pen_t vendor_id
, u_int32_t subtype
,
196 TNC_IMVID id
, TNC_Version
*actual_version
);
198 #endif /** IMV_AGENT_H_ @}*/