added TNC_IMC_ReceiveMessageLong() and TNC_IMV_ReceiveMessageLong() support
[strongswan.git] / src / libtnccs / tnc / imv / imv.h
1 /*
2 * Copyright (C) 2010-2011 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 * @defgroup imv imv
18 * @ingroup tnc
19 *
20 * @defgroup imvt imv
21 * @{ @ingroup imv
22 */
23
24 #ifndef IMV_H_
25 #define IMV_H_
26
27 #include <tncifimv.h>
28
29 #include <library.h>
30
31 typedef struct imv_t imv_t;
32
33 /**
34 * Controls a single Integrity Measurement Verifier (IMV)
35 */
36 struct imv_t {
37
38 /**
39 * The TNC Server calls this function to initialize the IMV and agree on
40 * the API version number to be used. It also supplies the IMV ID, an IMV
41 * identifier that the IMV must use when calling TNC Server callback functions.
42 *
43 * @param imvID IMV ID assigned by TNCS
44 * @param minVersion minimum API version supported
45 * @param maxVersion maximum API version supported by TNCS
46 * @param OutActualVersion mutually supported API version number
47 * @return TNC result code
48 */
49 TNC_Result (*initialize)(TNC_IMVID imvID,
50 TNC_Version minVersion,
51 TNC_Version maxVersion,
52 TNC_Version *OutActualVersion);
53
54 /**
55 * The TNC Server calls this function to inform the IMV that the state of
56 * the network connection identified by connectionID has changed to newState.
57 *
58 * @param imvID IMV ID assigned by TNCS
59 * @param connectionID network connection ID assigned by TNCS
60 * @param newState new network connection state
61 * @return TNC result code
62 */
63 TNC_Result (*notify_connection_change)(TNC_IMVID imvID,
64 TNC_ConnectionID connectionID,
65 TNC_ConnectionState newState);
66
67 /**
68 * The TNC Server calls this function at the end of an Integrity Check
69 * Handshake (after all IMC-IMV messages have been delivered) to solicit
70 * recommendations from IMVs that have not yet provided a recommendation.
71 *
72 * @param imvID IMV ID assigned by TNCS
73 * @param connectionID network connection ID assigned by TNCS
74 * @return TNC result code
75 */
76 TNC_Result (*solicit_recommendation)(TNC_IMVID imvID,
77 TNC_ConnectionID connectionID);
78
79 /**
80 * The TNC Server calls this function to deliver a message to the IMV.
81 * The message is contained in the buffer referenced by message and contains
82 * the number of octets indicated by messageLength. The type of the message
83 * is indicated by messageType.
84 *
85 * @param imvID IMV ID assigned by TNCS
86 * @param connectionID network connection ID assigned by TNCS
87 * @param message reference to buffer containing message
88 * @param messageLength number of octets in message
89 * @param messageType message type of message
90 * @return TNC result code
91 */
92 TNC_Result (*receive_message)(TNC_IMVID imvID,
93 TNC_ConnectionID connectionID,
94 TNC_BufferReference message,
95 TNC_UInt32 messageLength,
96 TNC_MessageType messageType);
97
98 /**
99 * The TNC Server calls this function to deliver a message to the IMV.
100 * The message is contained in the buffer referenced by message and contains
101 * the number of octets indicated by messageLength. The type of the message
102 * is indicated by the message Vendor ID and message subtype.
103 *
104 * @param imvID IMV ID assigned by TNCS
105 * @param connectionID network connection ID assigned by TNCS
106 * @param messageFlags message flags
107 * @param message reference to buffer containing message
108 * @param messageLength number of octets in message
109 * @param messageVendorID message Vendor ID
110 * @param messageSubtype message subtype
111 * @param sourceIMCID source IMC ID
112 * @param destinationIMVID destination IMV ID
113 * @return TNC result code
114 */
115 TNC_Result (*receive_message_long)(TNC_IMVID imvID,
116 TNC_ConnectionID connectionID,
117 TNC_UInt32 messageFlags,
118 TNC_BufferReference message,
119 TNC_UInt32 messageLength,
120 TNC_VendorID messageVendorID,
121 TNC_MessageSubtype messageSubtype,
122 TNC_UInt32 sourceIMCID,
123 TNC_UInt32 destinationIMVID);
124
125 /**
126 * The TNC Server calls this function to notify IMVs that all IMC messages
127 * received in a batch have been delivered and this is the IMV’s last chance
128 * to send a message in the batch of IMV messages currently being collected.
129 *
130 * @param imvID IMV ID assigned by TNCS
131 * @param connectionID network connection ID assigned by TNCS
132 * @return TNC result code
133 */
134 TNC_Result (*batch_ending)(TNC_IMVID imvID,
135 TNC_ConnectionID connectionID);
136
137 /**
138 * The TNC Server calls this function to close down the IMV.
139 *
140 * @param imvID IMV ID assigned by TNCS
141 * @return TNC result code
142 */
143 TNC_Result (*terminate)(TNC_IMVID imvID);
144
145 /**
146 * IMVs implementing the UNIX/Linux Dynamic Linkage platform binding MUST
147 * define this additional function. The TNC Server MUST call the function
148 * immediately after calling TNC_IMV_Initialize to provide a pointer to the
149 * TNCS bind function. The IMV can then use the TNCS bind function to obtain
150 * pointers to any other TNCS functions.
151 *
152 * @param imvID IMV ID assigned by TNCS
153 * @param bindFunction pointer to TNC_TNCS_BindFunction
154 * @return TNC result code
155 */
156 TNC_Result (*provide_bind_function)(TNC_IMVID imvID,
157 TNC_TNCS_BindFunctionPointer bindFunction);
158
159 /**
160 * Sets the ID of an imv_t object.
161 *
162 * @param id IMV ID to be assigned
163 */
164 void (*set_id)(imv_t *this, TNC_IMVID id);
165
166 /**
167 * Returns the ID of an imv_t object.
168 *
169 * @return IMV ID assigned by TNCS
170 */
171 TNC_IMVID (*get_id)(imv_t *this);
172
173 /**
174 * Assign an additional ID to an imv_t object.
175 *
176 * @param id additional IMV ID to be assigned
177 */
178 void (*add_id)(imv_t *this, TNC_IMVID id);
179
180 /**
181 * Checks if the ID is assigned to the imv_t object.
182 *
183 * @return TRUE if IMV ID is assigned to imv_t object
184 */
185 bool (*has_id)(imv_t *this, TNC_IMVID id);
186
187 /**
188 * Returns the name of an imv_t object.
189 *
190 * @return name of IMV
191 */
192 char* (*get_name)(imv_t *this);
193
194 /**
195 * Sets the supported message types of an imv_t object.
196 *
197 * @param supported_types list of messages type supported by IMV
198 * @param type_count number of supported message types
199 */
200 void (*set_message_types)(imv_t *this, TNC_MessageTypeList supported_types,
201 TNC_UInt32 type_count);
202
203 /**
204 * Sets the supported long message types of an imv_t object.
205 *
206 * @param supported_vids list of vendor IDs supported by IMC
207 * @param supported_subtypes list of messages type supported by IMC
208 * @param type_count number of supported message types
209 */
210 void (*set_message_types_long)(imv_t *this, TNC_VendorIDList supported_vids,
211 TNC_MessageSubtypeList supported_subtypes,
212 TNC_UInt32 type_count);
213
214 /**
215 * Check if the IMV supports a given message type.
216 *
217 * @param msg_vid message vendor ID
218 * @param msg_subtype message subtype
219 * @return TRUE if supported
220 */
221 bool (*type_supported)(imv_t *this, TNC_VendorID msg_vid,
222 TNC_MessageSubtype msg_subtype);
223
224 /**
225 * Destroys an imv_t object.
226 */
227 void (*destroy)(imv_t *this);
228 };
229
230 #endif /** IMV_H_ @}*/