return with TNC_RESULT_SUCCESS
[strongswan.git] / src / libtnccs / tnc / imv / imv.h
1 /*
2 * Copyright (C) 2010 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 notify IMVs that all IMC messages
100 * received in a batch have been delivered and this is the IMV’s last chance
101 * to send a message in the batch of IMV messages currently being collected.
102 *
103 * @param imvID IMV ID assigned by TNCS
104 * @param connectionID network connection ID assigned by TNCS
105 * @return TNC result code
106 */
107 TNC_Result (*batch_ending)(TNC_IMVID imvID,
108 TNC_ConnectionID connectionID);
109
110 /**
111 * The TNC Server calls this function to close down the IMV.
112 *
113 * @param imvID IMV ID assigned by TNCS
114 * @return TNC result code
115 */
116 TNC_Result (*terminate)(TNC_IMVID imvID);
117
118 /**
119 * IMVs implementing the UNIX/Linux Dynamic Linkage platform binding MUST
120 * define this additional function. The TNC Server MUST call the function
121 * immediately after calling TNC_IMV_Initialize to provide a pointer to the
122 * TNCS bind function. The IMV can then use the TNCS bind function to obtain
123 * pointers to any other TNCS functions.
124 *
125 * @param imvID IMV ID assigned by TNCS
126 * @param bindFunction pointer to TNC_TNCS_BindFunction
127 * @return TNC result code
128 */
129 TNC_Result (*provide_bind_function)(TNC_IMVID imvID,
130 TNC_TNCS_BindFunctionPointer bindFunction);
131
132 /**
133 * Sets the ID of an imv_t object.
134 *
135 * @param id IMV ID to be assigned
136 */
137 void (*set_id)(imv_t *this, TNC_IMVID id);
138
139 /**
140 * Returns the ID of an imv_t object.
141 *
142 * @return IMV ID assigned by TNCS
143 */
144 TNC_IMVID (*get_id)(imv_t *this);
145
146 /**
147 * Returns the name of an imv_t object.
148 *
149 * @return name of IMV
150 */
151 char* (*get_name)(imv_t *this);
152
153 /**
154 * Sets the supported message types of an imv_t object.
155 *
156 * @param supported_types list of messages type supported by IMV
157 * @param type_count number of supported message types
158 */
159 void (*set_message_types)(imv_t *this, TNC_MessageTypeList supported_types,
160 TNC_UInt32 type_count);
161
162 /**
163 * Sets the supported long message types of an imv_t object.
164 *
165 * @param supported_vids list of vendor IDs supported by IMC
166 * @param supported_subtypes list of messages type supported by IMC
167 * @param type_count number of supported message types
168 */
169 void (*set_message_types_long)(imv_t *this, TNC_VendorIDList supported_vids,
170 TNC_MessageSubtypeList supported_subtypes,
171 TNC_UInt32 type_count);
172
173 /**
174 * Check if the IMV supports a given message type.
175 *
176 * @param message_type message type
177 * @return TRUE if supported
178 */
179 bool (*type_supported)(imv_t *this, TNC_MessageType message_type);
180
181 /**
182 * Destroys an imv_t object.
183 */
184 void (*destroy)(imv_t *this);
185 };
186
187 #endif /** IMV_H_ @}*/