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 imc_agent_t imc_agent
18 * @{ @ingroup imc_agent
24 #include "imc_state.h"
25 #include "pa_tnc/pa_tnc_msg.h"
32 typedef struct imc_agent_t imc_agent_t
;
35 * Core functions of an Integrity Measurement Verifier (IMC)
40 * Ask a TNCC to retry an Integrity Check Handshake
42 * @param imc_id IMC ID assigned by TNCC
43 * @param connection_id network connection ID assigned by TNCC
44 * @param reason IMC retry reason
45 * @return TNC result code
47 TNC_Result (*request_handshake_retry
)(TNC_IMCID imc_id
,
48 TNC_ConnectionID connection_id
,
49 TNC_RetryReason reason
);
54 * @param bind_function function offered by the TNCC
55 * @return TNC result code
57 TNC_Result (*bind_functions
)(imc_agent_t
*this,
58 TNC_TNCC_BindFunctionPointer bind_function
);
61 * Create the IMC state for a TNCCS connection instance
63 * @param state internal IMC state instance
64 * @return TNC result code
66 TNC_Result (*create_state
)(imc_agent_t
*this, imc_state_t
*state
);
69 * Delete the IMC state for a TNCCS connection instance
71 * @param connection_id network connection ID assigned by TNCS
72 * @return TNC result code
74 TNC_Result (*delete_state
)(imc_agent_t
*this,
75 TNC_ConnectionID connection_id
);
78 * Change the current state of a TNCCS connection
80 * @param connection_id network connection ID assigned by TNCS
81 * @param new_state new state of TNCCS connection
82 * @return TNC result code
84 TNC_Result (*change_state
)(imc_agent_t
*this,
85 TNC_ConnectionID connection_id
,
86 TNC_ConnectionState new_state
);
89 * Get the IMC state for a TNCCS connection instance
91 * @param connection_id network connection ID assigned by TNCS
92 * @param state internal IMC state instance
93 * @return TRUE if the state was found
95 bool (*get_state
)(imc_agent_t
*this,
96 TNC_ConnectionID connection_id
, imc_state_t
**state
);
99 * Call when an PA-TNC message is to be sent
101 * @param connection_id network connection ID assigned by TNCC
102 * @param msg message to send
103 * @return TNC result code
105 TNC_Result (*send_message
)(imc_agent_t
*this,
106 TNC_ConnectionID connection_id
,
110 * Call when a PA-TNC message was received
112 * @param connection_id network connection ID assigned by TNCC
113 * @param msg received unparsed message
114 * @param msg_type message type of the received message
115 * @param pa_tnc_message parsed PA-TNC message or NULL if an error occurred
116 * @return TNC result code
118 TNC_Result (*receive_message
)(imc_agent_t
*this,
119 TNC_ConnectionID connection_id
, chunk_t msg
,
120 TNC_MessageType msg_type
,
121 pa_tnc_msg_t
**pa_tnc_msg
);
124 * Destroys an imc_agent_t object
126 void (*destroy
)(imc_agent_t
*this);
130 * Create an imc_agent_t object
132 * @param name name of the IMC
133 * @param vendor_id vendor ID of the IMC
134 * @param subtype message subtype of the IMC
135 * @param id ID of the IMC as assigned by the TNCS
136 * @param actual_version actual version of the IF-IMC API
139 imc_agent_t
*imc_agent_create(const char *name
,
140 pen_t vendor_id
, u_int32_t subtype
,
141 TNC_IMCID id
, TNC_Version
*actual_version
);
143 #endif /** IMC_AGENT_H_ @}*/