support of reportMessageTypes() function
[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
26 typedef struct imc_t imc_t;
27
28 struct imc_t {
29
30 /**
31 * The TNC Client calls this function to initialize the IMC and agree on
32 * the API version number to be used. It also supplies the IMC ID, an IMC
33 * identifier that the IMC must use when calling TNC Client callback functions.
34 *
35 * @param imcID IMC ID assigned by TNCC
36 * @param minVersion Minimum API version supported by TNCC
37 * @param maxVersion Maximum API version supported by TNCC
38 * @param OutActualVersion Mutually supported API version number
39 * @return TNC result code
40 */
41 TNC_Result (*initialize)(TNC_IMCID imcID,
42 TNC_Version minVersion,
43 TNC_Version maxVersion,
44 TNC_Version *OutActualVersion);
45
46 /**
47 * The TNC Client calls this function to inform the IMC that the state of
48 * the network connection identified by connectionID has changed to newState.
49 *
50 * @param imcID IMC ID assigned by TNCC
51 * @param connectionID Network connection ID assigned by TNCC
52 * @param newState New network connection state
53 * @return TNC result code
54 */
55 TNC_Result (*notify_connection_change)(TNC_IMCID imcID,
56 TNC_ConnectionID connectionID,
57 TNC_ConnectionState newState);
58
59 /**
60 * The TNC Client calls this function to indicate that an Integrity Check
61 * Handshake is beginning and solicit messages from IMCs for the first batch.
62 *
63 * @param imcID IMC ID assigned by TNCC
64 * @param connectionID Network connection ID assigned by TNCC
65 * @return TNC result code
66 */
67 TNC_Result (*begin_handshake)(TNC_IMCID imcID,
68 TNC_ConnectionID connectionID);
69
70 /**
71 * The TNC Client calls this function to deliver a message to the IMC.
72 * The message is contained in the buffer referenced by message and contains
73 * the number of octets indicated by messageLength. The type of the message
74 * is indicated by messageType.
75 *
76 * @param imcID IMC ID assigned by TNCS
77 * @param connectionID Network connection ID assigned by TNCC
78 * @param message Reference to buffer containing message
79 * @param messageLength Number of octets in message
80 * @param messageType Message type of message
81 * @return TNC result code
82 */
83 TNC_Result (*receive_message)(TNC_IMCID imcID,
84 TNC_ConnectionID connectionID,
85 TNC_BufferReference message,
86 TNC_UInt32 messageLength,
87 TNC_MessageType messageType);
88
89 /**
90 * The TNC Client calls this function to notify IMCs that all IMV messages
91 * received in a batch have been delivered and this is the IMC’s last chance
92 * to send a message in the batch of IMC messages currently being collected.
93 *
94 * @param imcID IMC ID assigned by TNCC
95 * @param connectionID Network connection ID assigned by TNCC
96 * @return TNC result code
97 */
98 TNC_Result (*batch_ending)(TNC_IMCID imcID,
99 TNC_ConnectionID connectionID);
100
101 /**
102 * The TNC Client calls this function to close down the IMC when all work is
103 * complete or the IMC reports TNC_RESULT_FATAL.
104 *
105 * @param imcID IMC ID assigned by TNCC
106 * @return TNC result code
107 */
108 TNC_Result (*terminate)(TNC_IMCID imcID);
109
110 /**
111 * IMVs implementing the UNIX/Linux Dynamic Linkage platform binding MUST
112 * define this additional function. The TNC Server MUST call the function
113 * immediately after calling TNC_IMV_Initialize to provide a pointer to the
114 * TNCS bind function. The IMV can then use the TNCS bind function to obtain
115 * pointers to any other TNCS functions.
116 *
117 * @param imcID IMC ID assigned by TNCC
118 * @param bindFunction Pointer to TNC_TNCC_BindFunction
119 * @return TNC result code
120 */
121 TNC_Result (*provide_bind_function)(TNC_IMCID imcID,
122 TNC_TNCC_BindFunctionPointer bindFunction);
123
124 /**
125 * Sets the ID of an imc_t object.
126 *
127 * @param id IMC ID to be assigned
128 */
129 void (*set_id)(imc_t *this, TNC_IMCID id);
130
131 /**
132 * Returns the ID of an imc_t object.
133 *
134 * @return assigned IMC ID
135 */
136 TNC_IMCID (*get_id)(imc_t *this);
137
138 /**
139 * Returns the name of an imc_t object.
140 *
141 * @return name of IMC
142 */
143 char* (*get_name)(imc_t *this);
144
145 /**
146 * Sets the supported message types of an imc_t object.
147 *
148 * @param supported_types List of messages type supported by IMC
149 * @param type_count Number of supported message types
150 */
151 void (*set_message_types)(imc_t *this, TNC_MessageTypeList supported_types,
152 TNC_UInt32 type_count);
153
154 /**
155 * Destroys an imc_t object.
156 */
157 void (*destroy)(imc_t *this);
158 };
159
160 #endif /** IMC_H_ @}*/