implemented IMC/IMV handler
[strongswan.git] / src / libcharon / tnc / tncifimv.h
1 /* tncifimv.h
2 *
3 * Trusted Network Connect IF-IMV API version 1.20
4 * Microsoft Windows DLL Platform Binding C Header
5 * February 5, 2007
6 *
7 * Copyright(c) 2005-2007, 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 * - Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * - 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 * - 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 #ifndef _TNCIFIMV_H
46 #define _TNCIFIMV_H
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 #ifdef WIN32
53 #ifdef TNC_IMV_EXPORTS
54 #define TNC_IMV_API __declspec(dllexport)
55 #else
56 #define TNC_IMV_API __declspec(dllimport)
57 #endif
58 #else
59 #define TNC_IMV_API
60 #endif
61
62 #include "tncif.h"
63
64 typedef TNC_UInt32 TNC_IMVID;
65 typedef TNC_UInt32 TNC_IMV_Action_Recommendation;
66 typedef TNC_UInt32 TNC_IMV_Evaluation_Result;
67 typedef TNC_UInt32 TNC_AttributeID;
68
69
70 /* Function pointers */
71
72 typedef TNC_Result (*TNC_IMV_InitializePointer)(
73 TNC_IMVID imvID,
74 TNC_Version minVersion,
75 TNC_Version maxVersion,
76 TNC_Version *pOutActualVersion);
77 typedef TNC_Result (*TNC_IMV_NotifyConnectionChangePointer)(
78 TNC_IMVID imvID,
79 TNC_ConnectionID connectionID,
80 TNC_ConnectionState newState);
81 typedef TNC_Result (*TNC_IMV_ReceiveMessagePointer)(
82 TNC_IMVID imvID,
83 TNC_ConnectionID connectionID,
84 TNC_BufferReference message,
85 TNC_UInt32 messageLength,
86 TNC_MessageType messageType);
87 typedef TNC_Result (*TNC_IMV_SolicitRecommendationPointer)(
88 TNC_IMVID imvID,
89 TNC_ConnectionID connectionID);
90 typedef TNC_Result (*TNC_IMV_BatchEndingPointer)(
91 TNC_IMVID imvID,
92 TNC_ConnectionID connectionID);
93 typedef TNC_Result (*TNC_IMV_TerminatePointer)(
94 TNC_IMVID imvID);
95 typedef TNC_Result (*TNC_TNCS_ReportMessageTypesPointer)(
96 TNC_IMVID imvID,
97 TNC_MessageTypeList supportedTypes,
98 TNC_UInt32 typeCount);
99 typedef TNC_Result (*TNC_TNCS_SendMessagePointer)(
100 TNC_IMVID imvID,
101 TNC_ConnectionID connectionID,
102 TNC_BufferReference message,
103 TNC_UInt32 messageLength,
104 TNC_MessageType messageType);
105 typedef TNC_Result (*TNC_TNCS_RequestHandshakeRetryPointer)(
106 TNC_IMVID imvID,
107 TNC_ConnectionID connectionID,
108 TNC_RetryReason reason);
109 typedef TNC_Result (*TNC_TNCS_ProvideRecommendationPointer)(
110 TNC_IMVID imvID,
111 TNC_ConnectionID connectionID,
112 TNC_IMV_Action_Recommendation recommendation,
113 TNC_IMV_Evaluation_Result evaluation);
114 typedef TNC_Result (*TNC_TNCS_GetAttributePointer)(
115 TNC_IMVID imvID,
116 TNC_ConnectionID connectionID,
117 TNC_AttributeID attributeID,
118 TNC_UInt32 bufferLength,
119 TNC_BufferReference buffer,
120 TNC_UInt32 *pOutValueLength);
121 typedef TNC_Result (*TNC_TNCS_SetAttributePointer)(
122 TNC_IMVID imvID,
123 TNC_ConnectionID connectionID,
124 TNC_AttributeID attributeID,
125 TNC_UInt32 bufferLength,
126 TNC_BufferReference buffer);
127 typedef TNC_Result (*TNC_TNCS_BindFunctionPointer)(
128 TNC_IMVID imvID,
129 char *functionName,
130 void **pOutfunctionPointer);
131 typedef TNC_Result (*TNC_IMV_ProvideBindFunctionPointer)(
132 TNC_IMVID imvID,
133 TNC_TNCS_BindFunctionPointer bindFunction);
134
135 /* Version Numbers */
136
137 #define TNC_IFIMV_VERSION_1 1
138
139 /* Handshake Retry Reason Values */
140
141 /* reserved for TNC_RETRY_REASON_IMC_REMEDIATION_COMPLETE: 0 */
142 /* reserved for TNC_RETRY_REASON_IMC_SERIOUS_EVENT: 1 */
143 /* reserved for TNC_RETRY_REASON_IMC_INFORMATIONAL_EVENT: 2 */
144 /* reserved for TNC_RETRY_REASON_IMC_PERIODIC: 3 */
145 #define TNC_RETRY_REASON_IMV_IMPORTANT_POLICY_CHANGE 4
146 #define TNC_RETRY_REASON_IMV_MINOR_POLICY_CHANGE 5
147 #define TNC_RETRY_REASON_IMV_SERIOUS_EVENT 6
148 #define TNC_RETRY_REASON_IMV_MINOR_EVENT 7
149 #define TNC_RETRY_REASON_IMV_PERIODIC 8
150
151 /* IMV Action Recommendation Values */
152
153 #define TNC_IMV_ACTION_RECOMMENDATION_ALLOW 0
154 #define TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS 1
155 #define TNC_IMV_ACTION_RECOMMENDATION_ISOLATE 2
156 #define TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION 3
157
158 /* IMV Evaluation Result Values */
159
160 #define TNC_IMV_EVALUATION_RESULT_COMPLIANT 0
161 #define TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MINOR 1
162 #define TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR 2
163 #define TNC_IMV_EVALUATION_RESULT_ERROR 3
164 #define TNC_IMV_EVALUATION_RESULT_DONT_KNOW 4
165
166 /* Message Attribute ID Values */
167
168 #define TNC_ATTRIBUTEID_PREFERRED_LANGUAGE ((TNC_AttributeID) 0x00000001)
169 #define TNC_ATTRIBUTEID_REASON_STRING ((TNC_AttributeID) 0x00000002)
170 #define TNC_ATTRIBUTEID_REASON_LANGUAGE ((TNC_AttributeID) 0x00000003)
171
172 /* IMV Functions */
173
174 TNC_IMV_API TNC_Result TNC_IMV_Initialize(
175 /*in*/ TNC_IMVID imvID,
176 /*in*/ TNC_Version minVersion,
177 /*in*/ TNC_Version maxVersion,
178 /*in*/ TNC_Version *pOutActualVersion);
179
180 TNC_IMV_API TNC_Result TNC_IMV_NotifyConnectionChange(
181 /*in*/ TNC_IMVID imvID,
182 /*in*/ TNC_ConnectionID connectionID,
183 /*in*/ TNC_ConnectionState newState);
184
185 TNC_IMV_API TNC_Result TNC_IMV_ReceiveMessage(
186 /*in*/ TNC_IMVID imvID,
187 /*in*/ TNC_ConnectionID connectionID,
188 /*in*/ TNC_BufferReference messageBuffer,
189 /*in*/ TNC_UInt32 messageLength,
190 /*in*/ TNC_MessageType messageType);
191
192 TNC_IMV_API TNC_Result TNC_IMV_SolicitRecommendation(
193 /*in*/ TNC_IMVID imvID,
194 /*in*/ TNC_ConnectionID connectionID);
195
196 TNC_IMV_API TNC_Result TNC_IMV_BatchEnding(
197 /*in*/ TNC_IMVID imvID,
198 /*in*/ TNC_ConnectionID connectionID);
199
200 TNC_IMV_API TNC_Result TNC_IMV_Terminate(
201 /*in*/ TNC_IMVID imvID);
202
203 TNC_IMV_API TNC_Result TNC_IMV_ProvideBindFunction(
204 /*in*/ TNC_IMVID imvID,
205 /*in*/ TNC_TNCS_BindFunctionPointer bindFunction);
206
207 /* TNC Server Functions */
208
209 TNC_Result TNC_TNCS_ReportMessageTypes(
210 /*in*/ TNC_IMVID imvID,
211 /*in*/ TNC_MessageTypeList supportedTypes,
212 /*in*/ TNC_UInt32 typeCount);
213
214 TNC_Result TNC_TNCS_SendMessage(
215 /*in*/ TNC_IMVID imvID,
216 /*in*/ TNC_ConnectionID connectionID,
217 /*in*/ TNC_BufferReference message,
218 /*in*/ TNC_UInt32 messageLength,
219 /*in*/ TNC_MessageType messageType);
220
221 TNC_Result TNC_TNCS_RequestHandshakeRetry(
222 /*in*/ TNC_IMVID imvID,
223 /*in*/ TNC_ConnectionID connectionID,
224 /*in*/ TNC_RetryReason reason);
225
226 TNC_Result TNC_TNCS_ProvideRecommendation(
227 /*in*/ TNC_IMVID imvID,
228 /*in*/ TNC_ConnectionID connectionID,
229 /*in*/ TNC_IMV_Action_Recommendation recommendation,
230 /*in*/ TNC_IMV_Evaluation_Result evaluation);
231
232 TNC_Result TNC_TNCS_GetAttribute(
233 /*in*/ TNC_IMVID imvID,
234 /*in*/ TNC_ConnectionID connectionID,
235 /*in*/ TNC_AttributeID attributeID,
236 /*in*/ TNC_UInt32 bufferLength,
237 /*out*/ TNC_BufferReference buffer,
238 /*out*/ TNC_UInt32 *pOutValueLength);
239
240 TNC_Result TNC_TNCS_SetAttribute(
241 /*in*/ TNC_IMVID imvID,
242 /*in*/ TNC_ConnectionID connectionID,
243 /*in*/ TNC_AttributeID attributeID,
244 /*in*/ TNC_UInt32 bufferLength,
245 /*in*/ TNC_BufferReference buffer);
246
247 TNC_Result TNC_TNCS_BindFunction(
248 /*in*/ TNC_IMVID imvID,
249 /*in*/ char *functionName,
250 /*in*/ void **pOutfunctionPointer);
251
252 #ifdef __cplusplus
253 }
254 #endif
255
256 #endif