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