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