xref: /freebsd/contrib/wpa/src/common/tnc.h (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1 /*
2  * TNC - Common defines
3  * Copyright (c) 2007-2014, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef TNC_H
10 #define TNC_H
11 
12 typedef unsigned long TNC_UInt32;
13 typedef unsigned char *TNC_BufferReference;
14 
15 typedef TNC_UInt32 TNC_IMVID;
16 typedef TNC_UInt32 TNC_IMCID;
17 typedef TNC_UInt32 TNC_ConnectionID;
18 typedef TNC_UInt32 TNC_ConnectionState;
19 typedef TNC_UInt32 TNC_RetryReason;
20 typedef TNC_UInt32 TNC_IMV_Action_Recommendation;
21 typedef TNC_UInt32 TNC_IMV_Evaluation_Result;
22 typedef TNC_UInt32 TNC_MessageType;
23 typedef TNC_MessageType *TNC_MessageTypeList;
24 typedef TNC_UInt32 TNC_VendorID;
25 typedef TNC_UInt32 TNC_Subtype;
26 typedef TNC_UInt32 TNC_MessageSubtype;
27 typedef TNC_UInt32 TNC_Version;
28 typedef TNC_UInt32 TNC_Result;
29 typedef TNC_UInt32 TNC_AttributeID;
30 
31 typedef TNC_Result (*TNC_TNCS_BindFunctionPointer)(
32 	TNC_IMVID imvID,
33 	char *functionName,
34 	void **pOutfunctionPointer);
35 typedef TNC_Result (*TNC_TNCS_ReportMessageTypesPointer)(
36 	TNC_IMVID imvID,
37 	TNC_MessageTypeList supportedTypes,
38 	TNC_UInt32 typeCount);
39 typedef TNC_Result (*TNC_TNCS_SendMessagePointer)(
40 	TNC_IMVID imvID,
41 	TNC_ConnectionID connectionID,
42 	TNC_BufferReference message,
43 	TNC_UInt32 messageLength,
44 	TNC_MessageType messageType);
45 typedef TNC_Result (*TNC_TNCS_RequestHandshakeRetryPointer)(
46 	TNC_IMVID imvID,
47 	TNC_ConnectionID connectionID,
48 	TNC_RetryReason reason);
49 typedef TNC_Result (*TNC_TNCS_ProvideRecommendationPointer)(
50 	TNC_IMVID imvID,
51 	TNC_ConnectionID connectionID,
52 	TNC_IMV_Action_Recommendation recommendation,
53 	TNC_IMV_Evaluation_Result evaluation);
54 typedef TNC_Result (*TNC_TNCC_BindFunctionPointer)(
55 	TNC_IMCID imcID,
56 	char *functionName,
57 	void **pOutfunctionPointer);
58 typedef TNC_Result (*TNC_TNCC_SendMessagePointer)(
59 	TNC_IMCID imcID,
60 	TNC_ConnectionID connectionID,
61 	TNC_BufferReference message,
62 	TNC_UInt32 messageLength,
63 	TNC_MessageType messageType);
64 typedef TNC_Result (*TNC_TNCC_ReportMessageTypesPointer)(
65 	TNC_IMCID imcID,
66 	TNC_MessageTypeList supportedTypes,
67 	TNC_UInt32 typeCount);
68 typedef TNC_Result (*TNC_TNCC_RequestHandshakeRetryPointer)(
69 	TNC_IMCID imcID,
70 	TNC_ConnectionID connectionID,
71 	TNC_RetryReason reason);
72 
73 #define TNC_IFIMV_VERSION_1 1
74 #define TNC_IFIMC_VERSION_1 1
75 
76 #define TNC_RESULT_SUCCESS 0
77 #define TNC_RESULT_NOT_INITIALIZED 1
78 #define TNC_RESULT_ALREADY_INITIALIZED 2
79 #define TNC_RESULT_NO_COMMON_VERSION 3
80 #define TNC_RESULT_CANT_RETRY 4
81 #define TNC_RESULT_WONT_RETRY 5
82 #define TNC_RESULT_INVALID_PARAMETER 6
83 #define TNC_RESULT_CANT_RESPOND 7
84 #define TNC_RESULT_ILLEGAL_OPERATION 8
85 #define TNC_RESULT_OTHER 9
86 #define TNC_RESULT_FATAL 10
87 
88 #define TNC_CONNECTION_STATE_CREATE 0
89 #define TNC_CONNECTION_STATE_HANDSHAKE 1
90 #define TNC_CONNECTION_STATE_ACCESS_ALLOWED 2
91 #define TNC_CONNECTION_STATE_ACCESS_ISOLATED 3
92 #define TNC_CONNECTION_STATE_ACCESS_NONE 4
93 #define TNC_CONNECTION_STATE_DELETE 5
94 
95 #define TNC_VENDORID_ANY ((TNC_VendorID) 0xffffff)
96 #define TNC_SUBTYPE_ANY ((TNC_Subtype) 0xff)
97 
98 /* TNCC-TNCS Message Types */
99 #define TNC_TNCCS_RECOMMENDATION		0x00000001
100 #define TNC_TNCCS_ERROR				0x00000002
101 #define TNC_TNCCS_PREFERREDLANGUAGE		0x00000003
102 #define TNC_TNCCS_REASONSTRINGS			0x00000004
103 
104 /* Possible TNC_IMV_Action_Recommendation values: */
105 enum IMV_Action_Recommendation {
106 	TNC_IMV_ACTION_RECOMMENDATION_ALLOW,
107 	TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS,
108 	TNC_IMV_ACTION_RECOMMENDATION_ISOLATE,
109 	TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION
110 };
111 
112 /* Possible TNC_IMV_Evaluation_Result values: */
113 enum IMV_Evaluation_Result {
114 	TNC_IMV_EVALUATION_RESULT_COMPLIANT,
115 	TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MINOR,
116 	TNC_IMV_EVALUATION_RESULT_NONCOMPLIANT_MAJOR,
117 	TNC_IMV_EVALUATION_RESULT_ERROR,
118 	TNC_IMV_EVALUATION_RESULT_DONT_KNOW
119 };
120 
121 #endif /* TNC_H */
122