unit-tests: Fix "using integer constants in boolean context" warning
[strongswan.git] / src / libtncif / tncifimv.h
1 /* tncifimv.h
2 *
3 * Trusted Network Connect IF-IMV API version 1.30
4 * Microsoft Windows DLL Platform Binding C Header
5 * October 14, 2011
6 *
7 * Copyright(c) 2005-2011, Trusted Computing Group, Inc. All rights
8 * reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * o Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * o Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 * o Neither the name of the Trusted Computing Group nor the names of
20 * its contributors may be used to endorse or promote products
21 * derived from this software without specific prior written
22 * permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Contact the Trusted Computing Group at
38 * admin@trustedcomputinggroup.org for information on specification
39 * licensing through membership agreements.
40 *
41 * Any marks and brands contained herein are the property of their
42 * respective owners.
43 */
44
45 /**
46 * @defgroup tncifimv tncifimv
47 * @{ @ingroup libtncif
48 */
49
50 #ifndef TNCIFIMV_H_
51 #define TNCIFIMV_H_
52
53 #include "tncif.h"
54
55 #ifdef WIN32
56 #ifdef TNC_IMV_EXPORTS
57 #define TNC_IMV_API __declspec(dllexport)
58 #else
59 #define TNC_IMV_API __declspec(dllimport)
60 #endif
61 #else
62 #define TNC_IMV_API
63 #endif
64
65 /* Derived Types */
66
67 typedef TNC_UInt32 TNC_IMVID;
68 typedef TNC_UInt32 TNC_IMV_Action_Recommendation;
69 typedef TNC_UInt32 TNC_IMV_Evaluation_Result;
70
71 /* Function pointers */
72
73 typedef TNC_Result (*TNC_IMV_InitializePointer)(
74 TNC_IMVID imvID,
75 TNC_Version minVersion,
76 TNC_Version maxVersion,
77 TNC_Version *pOutActualVersion);
78 typedef TNC_Result (*TNC_IMV_NotifyConnectionChangePointer)(
79 TNC_IMVID imvID,
80 TNC_ConnectionID connectionID,
81 TNC_ConnectionState newState);
82 typedef TNC_Result (*TNC_IMV_ReceiveMessagePointer)(
83 TNC_IMVID imvID,
84 TNC_ConnectionID connectionID,
85 TNC_BufferReference message,
86 TNC_UInt32 messageLength,
87 TNC_MessageType messageType);
88 typedef TNC_Result (*TNC_IMV_ReceiveMessageSOHPointer)(
89 TNC_IMVID imvID,
90 TNC_ConnectionID connectionID,
91 TNC_BufferReference sohReportEntry,
92 TNC_UInt32 sohRELength,
93 TNC_MessageType systemHealthID);
94 typedef TNC_Result (*TNC_IMV_ReceiveMessageLongPointer)(
95 TNC_IMVID imvID,
96 TNC_ConnectionID connectionID,
97 TNC_UInt32 messageFlags,
98 TNC_BufferReference message,
99 TNC_UInt32 messageLength,
100 TNC_VendorID messageVendorID,
101 TNC_MessageSubtype messageSubtype,
102 TNC_UInt32 sourceIMCID,
103 TNC_UInt32 destinationIMVID);
104 typedef TNC_Result (*TNC_IMV_SolicitRecommendationPointer)(
105 TNC_IMVID imvID,
106 TNC_ConnectionID connectionID);
107 typedef TNC_Result (*TNC_IMV_BatchEndingPointer)(
108 TNC_IMVID imvID,
109 TNC_ConnectionID connectionID);
110 typedef TNC_Result (*TNC_IMV_TerminatePointer)(
111 TNC_IMVID imvID);
112 typedef TNC_Result (*TNC_TNCS_ReportMessageTypesPointer)(
113 TNC_IMVID imvID,
114 TNC_MessageTypeList supportedTypes,
115 TNC_UInt32 typeCount);
116 typedef TNC_Result (*TNC_TNCS_ReportMessageTypesLongPointer)(
117 TNC_IMVID imvID,
118 TNC_VendorIDList supportedVendorIDs,
119 TNC_MessageSubtypeList supportedSubtypes,
120 TNC_UInt32 typeCount);
121 typedef TNC_Result (*TNC_TNCS_SendMessagePointer)(
122 TNC_IMVID imvID,
123 TNC_ConnectionID connectionID,
124 TNC_BufferReference message,
125 TNC_UInt32 messageLength,
126 TNC_MessageType messageType);
127 typedef TNC_Result (*TNC_TNCS_SendMessageSOHPointer)(
128 TNC_IMVID imvID,
129 TNC_ConnectionID connectionID,
130 TNC_BufferReference sohrReportEntry,
131 TNC_UInt32 sohrRELength);
132 typedef TNC_Result (*TNC_TNCS_SendMessageLongPointer)(
133 TNC_IMVID imvID,
134 TNC_ConnectionID connectionID,
135 TNC_UInt32 messageFlags,
136 TNC_BufferReference message,
137 TNC_UInt32 messageLength,
138 TNC_VendorID messageVendorID,
139 TNC_MessageSubtype messageSubtype,
140 TNC_UInt32 destinationIMCID);
141 typedef TNC_Result (*TNC_TNCS_RequestHandshakeRetryPointer)(
142 TNC_IMVID imvID,
143 TNC_ConnectionID connectionID,
144 TNC_RetryReason reason);
145 typedef TNC_Result (*TNC_TNCS_ProvideRecommendationPointer)(
146 TNC_IMVID imvID,
147 TNC_ConnectionID connectionID,
148 TNC_IMV_Action_Recommendation recommendation,
149 TNC_IMV_Evaluation_Result evaluation);
150 typedef TNC_Result (*TNC_TNCS_GetAttributePointer)(
151 TNC_IMVID imvID,
152 TNC_ConnectionID connectionID,
153 TNC_AttributeID attributeID,
154 TNC_UInt32 bufferLength,
155 TNC_BufferReference buffer,
156 TNC_UInt32 *pOutValueLength);
157 typedef TNC_Result (*TNC_TNCS_SetAttributePointer)(
158 TNC_IMVID imvID,
159 TNC_ConnectionID connectionID,
160 TNC_AttributeID attributeID,
161 TNC_UInt32 bufferLength,
162 TNC_BufferReference buffer);
163 typedef TNC_Result (*TNC_TNCS_ReserveAdditionalIMVIDPointer)(
164 TNC_IMVID imvID,
165 TNC_UInt32 *pOutIMVID);
166 typedef TNC_Result (*TNC_TNCS_BindFunctionPointer)(
167 TNC_IMVID imvID,
168 char *functionName,
169 void **pOutfunctionPointer);
170 typedef TNC_Result (*TNC_IMV_ProvideBindFunctionPointer)(
171 TNC_IMVID imvID,
172 TNC_TNCS_BindFunctionPointer bindFunction);
173
174 /* Version Numbers */
175
176 #define TNC_IFIMV_VERSION_1 1
177
178 /* Handshake Retry Reason Values */
179
180 /* reserved for TNC_RETRY_REASON_IMC_REMEDIATION_COMPLETE: 0 */
181 /* reserved for TNC_RETRY_REASON_IMC_SERIOUS_EVENT: 1 */
182 /* reserved for TNC_RETRY_REASON_IMC_INFORMATIONAL_EVENT: 2 */
183 /* reserved for TNC_RETRY_REASON_IMC_PERIODIC: 3 */
184 #define TNC_RETRY_REASON_IMV_IMPORTANT_POLICY_CHANGE 4
185 #define TNC_RETRY_REASON_IMV_MINOR_POLICY_CHANGE 5
186 #define TNC_RETRY_REASON_IMV_SERIOUS_EVENT 6
187 #define TNC_RETRY_REASON_IMV_MINOR_EVENT 7
188 #define TNC_RETRY_REASON_IMV_PERIODIC 8
189
190 /* IMV Action Recommendation Values */
191
192 #define TNC_IMV_ACTION_RECOMMENDATION_ALLOW 0
193 #define TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS 1
194 #define TNC_IMV_ACTION_RECOMMENDATION_ISOLATE 2
195 #define TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION 3
196
197 /* IMV Evaluation Result Values */
198
199 #define TNC_IMV_EVALUATION_RESULT_COMPLIANT 0
200 #define TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MINOR 1
201 #define TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR 2
202 #define TNC_IMV_EVALUATION_RESULT_ERROR 3
203 #define TNC_IMV_EVALUATION_RESULT_DONT_KNOW 4
204
205 /* Message Attribute ID Values */
206
207 #define TNC_ATTRIBUTEID_REASON_STRING ((TNC_AttributeID) 0x00000002)
208 #define TNC_ATTRIBUTEID_REASON_LANGUAGE ((TNC_AttributeID) 0x00000003)
209 #define TNC_ATTRIBUTEID_SOH ((TNC_AttributeID) 0x00559706)
210 #define TNC_ATTRIBUTEID_SSOH ((TNC_AttributeID) 0x00559707)
211 #define TNC_ATTRIBUTEID_PRIMARY_IMV_ID ((TNC_AttributeID) 0x00559710)
212 #define TNC_ATTRIBUTEID_AR_IDENTITIES ((TNC_AttributeID) 0x00559712)
213
214 /* TNC Identity Types */
215
216 #define TNC_ID_UNKNOWN 0
217 #define TNC_ID_IPV4_ADDR 1
218 #define TNC_ID_IPV6_ADDR 2
219 #define TNC_ID_FQDN 3
220 #define TNC_ID_EMAIL_ADDR 4
221 #define TNC_ID_USERNAME 5
222 #define TNC_ID_X500_DN 6
223
224 /* TNC Subject Types */
225
226 #define TNC_SUBJECT_UNKNOWN 0
227 #define TNC_SUBJECT_MACHINE 1
228 #define TNC_SUBJECT_USER 2
229
230 /* TNC Authentication Types */
231
232 #define TNC_AUTH_UNKNOWN 0
233 #define TNC_AUTH_X509_CERT 1
234 #define TNC_AUTH_PASSWORD 2
235 #define TNC_AUTH_SIM 3
236
237 /* IMV Functions */
238
239 TNC_IMV_API TNC_Result TNC_IMV_Initialize(
240 /*in*/ TNC_IMVID imvID,
241 /*in*/ TNC_Version minVersion,
242 /*in*/ TNC_Version maxVersion,
243 /*in*/ TNC_Version *pOutActualVersion);
244
245 TNC_IMV_API TNC_Result TNC_IMV_NotifyConnectionChange(
246 /*in*/ TNC_IMVID imvID,
247 /*in*/ TNC_ConnectionID connectionID,
248 /*in*/ TNC_ConnectionState newState);
249
250 TNC_IMV_API TNC_Result TNC_IMV_ReceiveMessage(
251 /*in*/ TNC_IMVID imvID,
252 /*in*/ TNC_ConnectionID connectionID,
253 /*in*/ TNC_BufferReference messageBuffer,
254 /*in*/ TNC_UInt32 messageLength,
255 /*in*/ TNC_MessageType messageType);
256
257 TNC_IMV_API TNC_Result TNC_IMV_ReceiveMessageSOH(
258 /*in*/ TNC_IMVID imvID,
259 /*in*/ TNC_ConnectionID connectionID,
260 /*in*/ TNC_BufferReference sohReportEntry,
261 /*in*/ TNC_UInt32 sohRELength,
262 /*in*/ TNC_MessageType systemHealthID);
263
264 TNC_IMV_API TNC_Result TNC_IMV_ReceiveMessageLong(
265 /*in*/ TNC_IMVID imvID,
266 /*in*/ TNC_ConnectionID connectionID,
267 /*in*/ TNC_UInt32 messageFlags,
268 /*in*/ TNC_BufferReference message,
269 /*in*/ TNC_UInt32 messageLength,
270 /*in*/ TNC_VendorID messageVendorID,
271 /*in*/ TNC_MessageSubtype messageSubtype,
272 /*in*/ TNC_UInt32 sourceIMCID,
273 /*in*/ TNC_UInt32 destinationIMVID);
274
275 TNC_IMV_API TNC_Result TNC_IMV_SolicitRecommendation(
276 /*in*/ TNC_IMVID imvID,
277 /*in*/ TNC_ConnectionID connectionID);
278
279 TNC_IMV_API TNC_Result TNC_IMV_BatchEnding(
280 /*in*/ TNC_IMVID imvID,
281 /*in*/ TNC_ConnectionID connectionID);
282
283 TNC_IMV_API TNC_Result TNC_IMV_Terminate(
284 /*in*/ TNC_IMVID imvID);
285
286 TNC_IMV_API TNC_Result TNC_IMV_ProvideBindFunction(
287 /*in*/ TNC_IMVID imvID,
288 /*in*/ TNC_TNCS_BindFunctionPointer bindFunction);
289
290 /* TNC Server Functions */
291
292 TNC_Result TNC_TNCS_ReportMessageTypes(
293 /*in*/ TNC_IMVID imvID,
294 /*in*/ TNC_MessageTypeList supportedTypes,
295 /*in*/ TNC_UInt32 typeCount);
296
297 TNC_Result TNC_TNCS_ReportMessageTypesLong(
298 /*in*/ TNC_IMVID imvID,
299 /*in*/ TNC_VendorIDList supportedVendorIDs,
300 /*in*/ TNC_MessageSubtypeList supportedSubtypes,
301 /*in*/ TNC_UInt32 typeCount);
302
303 TNC_Result TNC_TNCS_SendMessage(
304 /*in*/ TNC_IMVID imvID,
305 /*in*/ TNC_ConnectionID connectionID,
306 /*in*/ TNC_BufferReference message,
307 /*in*/ TNC_UInt32 messageLength,
308 /*in*/ TNC_MessageType messageType);
309
310 TNC_Result TNC_TNCS_SendMessageSOH(
311 /*in*/ TNC_IMVID imvID,
312 /*in*/ TNC_ConnectionID connectionID,
313 /*in*/ TNC_BufferReference sohrReportEntry,
314 /*in*/ TNC_UInt32 sohrRELength);
315
316 TNC_Result TNC_TNCS_SendMessageLong(
317 /*in*/ TNC_IMVID imvID,
318 /*in*/ TNC_ConnectionID connectionID,
319 /*in*/ TNC_UInt32 messageFlags,
320 /*in*/ TNC_BufferReference message,
321 /*in*/ TNC_UInt32 messageLength,
322 /*in*/ TNC_VendorID messageVendorID,
323 /*in*/ TNC_MessageSubtype messageSubtype,
324 /*in*/ TNC_UInt32 destinationIMCID);
325
326 TNC_Result TNC_TNCS_RequestHandshakeRetry(
327 /*in*/ TNC_IMVID imvID,
328 /*in*/ TNC_ConnectionID connectionID,
329 /*in*/ TNC_RetryReason reason);
330
331 TNC_Result TNC_TNCS_ProvideRecommendation(
332 /*in*/ TNC_IMVID imvID,
333 /*in*/ TNC_ConnectionID connectionID,
334 /*in*/ TNC_IMV_Action_Recommendation recommendation,
335 /*in*/ TNC_IMV_Evaluation_Result evaluation);
336
337 TNC_Result TNC_TNCS_GetAttribute(
338 /*in*/ TNC_IMVID imvID,
339 /*in*/ TNC_ConnectionID connectionID,
340 /*in*/ TNC_AttributeID attributeID,
341 /*in*/ TNC_UInt32 bufferLength,
342 /*out*/ TNC_BufferReference buffer,
343 /*out*/ TNC_UInt32 *pOutValueLength);
344
345 TNC_Result TNC_TNCS_ReserveAdditionalIMVID(
346 /*in*/ TNC_IMVID imvID,
347 /*out*/ TNC_UInt32 *pOutIMVID);
348
349 TNC_Result TNC_TNCS_SetAttribute(
350 /*in*/ TNC_IMVID imvID,
351 /*in*/ TNC_ConnectionID connectionID,
352 /*in*/ TNC_AttributeID attributeID,
353 /*in*/ TNC_UInt32 bufferLength,
354 /*in*/ TNC_BufferReference buffer);
355 TNC_Result TNC_TNCS_BindFunction(
356 /*in*/ TNC_IMVID imvID,
357 /*in*/ char *functionName,
358 /*in*/ void **pOutfunctionPointer);
359
360 #endif /** TNCIFIMV_H_ @}*/