imv/imc header cosmetics
[strongswan.git] / src / libcharon / 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 libcharon
19 */
20
21 #ifndef IMV_H_
22 #define IMV_H_
23
24 #include <tnc/tncifimv.h>
25 #include <library.h>
26
27 typedef struct imv_t imv_t;
28
29 /**
30 * Controls a single Integrity Measurement Verifier (IMV)
31 */
32 struct imv_t {
33
34 /**
35 * The TNC Server calls this function to initialize the IMV and agree on
36 * the API version number to be used. It also supplies the IMV ID, an IMV
37 * identifier that the IMV must use when calling TNC Server callback functions.
38 *
39 * @param imvID IMV ID assigned by TNCS
40 * @param minVersion minimum API version supported
41 * @param maxVersion maximum API version supported by TNCS
42 * @param OutActualVersion mutually supported API version number
43 * @return TNC result code
44 */
45 TNC_Result (*initialize)(TNC_IMVID imvID,
46 TNC_Version minVersion,
47 TNC_Version maxVersion,
48 TNC_Version *OutActualVersion);
49
50 /**
51 * The TNC Server calls this function to inform the IMV that the state of
52 * the network connection identified by connectionID has changed to newState.
53 *
54 * @param imvID IMV ID assigned by TNCS
55 * @param connectionID network connection ID assigned by TNCS
56 * @param newState new network connection state
57 * @return TNC result code
58 */
59 TNC_Result (*notify_connection_change)(TNC_IMVID imvID,
60 TNC_ConnectionID connectionID,
61 TNC_ConnectionState newState);
62
63 /**
64 * The TNC Server calls this function at the end of an Integrity Check
65 * Handshake (after all IMC-IMV messages have been delivered) to solicit
66 * recommendations from IMVs that have not yet provided a recommendation.
67 *
68 * @param imvID IMV ID assigned by TNCS
69 * @param connectionID network connection ID assigned by TNCS
70 * @return TNC result code
71 */
72 TNC_Result (*solicit_recommendation)(TNC_IMVID imvID,
73 TNC_ConnectionID connectionID);
74
75 /**
76 * The TNC Server calls this function to deliver a message to the IMV.
77 * The message is contained in the buffer referenced by message and contains
78 * the number of octets indicated by messageLength. The type of the message
79 * is indicated by messageType.
80 *
81 * @param imvID IMV ID assigned by TNCS
82 * @param connectionID network connection ID assigned by TNCS
83 * @param message reference to buffer containing message
84 * @param messageLength number of octets in message
85 * @param messageType message type of message
86 * @return TNC result code
87 */
88 TNC_Result (*receive_message)(TNC_IMVID imvID,
89 TNC_ConnectionID connectionID,
90 TNC_BufferReference message,
91 TNC_UInt32 messageLength,
92 TNC_MessageType messageType);
93
94 /**
95 * The TNC Server calls this function to notify IMVs that all IMC messages
96 * received in a batch have been delivered and this is the IMV’s last chance
97 * to send a message in the batch of IMV messages currently being collected.
98 *
99 * @param imvID IMV ID assigned by TNCS
100 * @param connectionID network connection ID assigned by TNCS
101 * @return TNC result code
102 */
103 TNC_Result (*batch_ending)(TNC_IMVID imvID,
104 TNC_ConnectionID connectionID);
105
106 /**
107 * The TNC Server calls this function to close down the IMV.
108 *
109 * @param imvID IMV ID assigned by TNCS
110 * @return TNC result code
111 */
112 TNC_Result (*terminate)(TNC_IMVID imvID);
113
114 /**
115 * IMVs implementing the UNIX/Linux Dynamic Linkage platform binding MUST
116 * define this additional function. The TNC Server MUST call the function
117 * immediately after calling TNC_IMV_Initialize to provide a pointer to the
118 * TNCS bind function. The IMV can then use the TNCS bind function to obtain
119 * pointers to any other TNCS functions.
120 *
121 * @param imvID IMV ID assigned by TNCS
122 * @param bindFunction pointer to TNC_TNCS_BindFunction
123 * @return TNC result code
124 */
125 TNC_Result (*provide_bind_function)(TNC_IMVID imvID,
126 TNC_TNCS_BindFunctionPointer bindFunction);
127
128 /**
129 * Sets the ID of an imv_t object.
130 *
131 * @param id IMV ID to be assigned
132 */
133 void (*set_id)(imv_t *this, TNC_IMVID id);
134
135 /**
136 * Returns the ID of an imv_t object.
137 *
138 * @return IMV ID assigned by TNCS
139 */
140 TNC_IMVID (*get_id)(imv_t *this);
141
142 /**
143 * Returns the name of an imv_t object.
144 *
145 * @return name of IMV
146 */
147 char* (*get_name)(imv_t *this);
148
149 /**
150 * Sets the supported message types of an imv_t object.
151 *
152 * @param supported_types list of messages type supported by IMV
153 * @param type_count number of supported message types
154 */
155 void (*set_message_types)(imv_t *this, TNC_MessageTypeList supported_types,
156 TNC_UInt32 type_count);
157
158 /**
159 * Check if the IMV supports a given message type.
160 *
161 * @param message_type message type
162 * @return TRUE if supported
163 */
164 bool (*type_supported)(imv_t *this, TNC_MessageType message_type);
165
166 /**
167 * Destroys an imv_t object.
168 */
169 void (*destroy)(imv_t *this);
170 };
171
172 #endif /** IMV_H_ @}*/