]>
Commit | Line | Data |
---|---|---|
b2563331 AS |
1 | /* |
2 | * Copyright (C) 2010 Andreas Steffen | |
19ef2aec TB |
3 | * |
4 | * Copyright (C) secunet Security Networks AG | |
b2563331 AS |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2 of the License, or (at your | |
9 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | * for more details. | |
15 | */ | |
16 | ||
17 | /** | |
18 | * @defgroup imc_manager imc_manager | |
19 | * @{ @ingroup imc | |
20 | */ | |
21 | ||
22 | #ifndef IMC_MANAGER_H_ | |
23 | #define IMC_MANAGER_H_ | |
24 | ||
328b377e AS |
25 | typedef struct imc_manager_t imc_manager_t; |
26 | ||
b2563331 AS |
27 | #include "imc.h" |
28 | ||
29 | #include <library.h> | |
30 | ||
b2563331 AS |
31 | /** |
32 | * The IMC manager controls all IMC instances. | |
33 | */ | |
34 | struct imc_manager_t { | |
35 | ||
36 | /** | |
37 | * Add an IMC instance | |
38 | * | |
9b43ae9c AS |
39 | * @param imc IMC instance |
40 | * @return TRUE if initialization successful | |
b2563331 AS |
41 | */ |
42 | bool (*add)(imc_manager_t *this, imc_t *imc); | |
43 | ||
1dc7b22c AS |
44 | /** |
45 | * Remove an IMC instance from the list and return it | |
46 | * | |
47 | * @param id ID of IMC instance | |
48 | * @return removed IMC instance | |
49 | */ | |
50 | imc_t* (*remove)(imc_manager_t *this, TNC_IMCID id); | |
51 | ||
f0a8bf47 | 52 | /** |
5d36af69 | 53 | * Load and initialize an IMC as a dynamic library and add it to the list |
f0a8bf47 | 54 | * |
5d36af69 AS |
55 | * @param name name of the IMC to be loaded |
56 | * @param path path of the IMC dynamic library file | |
57 | * @return TRUE if loading succeeded | |
f0a8bf47 | 58 | */ |
016d343a MW |
59 | bool (*load)(imc_manager_t *this, char *name, char *path); |
60 | ||
61 | /** | |
62 | * Load and initialize an IMC from a set of TNC IMC functions. | |
63 | * | |
64 | * @param name name of the IMC | |
65 | * @param initialize TNC_IMC_InitializePointer | |
66 | * @param notify_connection_change TNC_IMC_NotifyConnectionChangePointer | |
67 | * @param begin_handshake TNC_IMC_BeginHandshakePointer | |
68 | * @param receive_message TNC_IMC_ReceiveMessagePointer | |
69 | * @param receive_message_long TNC_IMC_ReceiveMessageLongPointer | |
70 | * @param batch_ending TNC_IMC_BatchEndingPointer | |
71 | * @param terminate TNC_IMC_TerminatePointer | |
72 | * @param provide_bind_function TNC_IMC_ProvideBindFunctionPointer | |
73 | * @return TRUE if loading succeeded | |
74 | */ | |
75 | bool (*load_from_functions)(imc_manager_t *this, char *name, | |
76 | TNC_IMC_InitializePointer initialize, | |
77 | TNC_IMC_NotifyConnectionChangePointer notify_connection_change, | |
78 | TNC_IMC_BeginHandshakePointer begin_handshake, | |
79 | TNC_IMC_ReceiveMessagePointer receive_message, | |
80 | TNC_IMC_ReceiveMessageLongPointer receive_message_long, | |
81 | TNC_IMC_BatchEndingPointer batch_ending, | |
82 | TNC_IMC_TerminatePointer terminate, | |
83 | TNC_IMC_ProvideBindFunctionPointer provide_bind_function); | |
f0a8bf47 | 84 | |
e8a512f8 AS |
85 | /** |
86 | * Check if an IMC with a given ID is registered with the IMC manager | |
87 | * | |
88 | * @param id ID of IMC instance | |
89 | * @return TRUE if registered | |
90 | */ | |
91 | bool (*is_registered)(imc_manager_t *this, TNC_IMCID id); | |
92 | ||
80ca4e50 AS |
93 | /** |
94 | * Reserve an additional ID for an IMC | |
95 | * | |
96 | * @param id ID of IMC instance | |
97 | * @param new_id reserved ID assigned to IMC | |
98 | * @return TRUE if primary IMC ID was used | |
99 | */ | |
100 | bool (*reserve_id)(imc_manager_t *this, TNC_IMCID id, TNC_UInt32 *new_id); | |
101 | ||
e2a0bea5 AS |
102 | /** |
103 | * Return the preferred language for recommendations | |
104 | * | |
105 | * @return preferred language string | |
106 | */ | |
107 | char* (*get_preferred_language)(imc_manager_t *this); | |
108 | ||
b2563331 AS |
109 | /** |
110 | * Notify all IMC instances | |
111 | * | |
112 | * @param state communicate the state a connection has reached | |
113 | */ | |
114 | void (*notify_connection_change)(imc_manager_t *this, | |
115 | TNC_ConnectionID id, | |
116 | TNC_ConnectionState state); | |
117 | ||
118 | /** | |
119 | * Begin a handshake between the IMCs and a connection | |
120 | * | |
10b9d524 | 121 | * @param id connection ID |
b2563331 AS |
122 | */ |
123 | void (*begin_handshake)(imc_manager_t *this, TNC_ConnectionID id); | |
124 | ||
29663625 AS |
125 | /** |
126 | * Sets the supported message types reported by a given IMC | |
127 | * | |
10b9d524 AS |
128 | * @param id ID of reporting IMC |
129 | * @param supported_types list of messages type supported by IMC | |
130 | * @param type_count number of supported message types | |
131 | * @return TNC result code | |
29663625 AS |
132 | */ |
133 | TNC_Result (*set_message_types)(imc_manager_t *this, | |
134 | TNC_IMCID id, | |
135 | TNC_MessageTypeList supported_types, | |
136 | TNC_UInt32 type_count); | |
137 | ||
10b9d524 AS |
138 | /** |
139 | * Sets the supported long message types reported by a given IMC | |
140 | * | |
141 | * @param id ID of reporting IMC | |
142 | * @param supported_vids list of vendor IDs supported by IMC | |
143 | * @param supported_subtypes list of messages type supported by IMC | |
144 | * @param type_count number of supported message types | |
145 | * @return TNC result code | |
146 | */ | |
147 | TNC_Result (*set_message_types_long)(imc_manager_t *this, | |
148 | TNC_IMCID id, | |
149 | TNC_VendorIDList supported_vids, | |
150 | TNC_MessageSubtypeList supported_subtypes, | |
151 | TNC_UInt32 type_count); | |
152 | ||
e6b6fc88 AS |
153 | /** |
154 | * Delivers a message to interested IMCs. | |
155 | * | |
584282d7 AS |
156 | * @param connection_id connection ID |
157 | * @param excl exclusive message flag | |
158 | * @param msg message | |
159 | * @param msg_len message length | |
160 | * @param msg_vid message Vendor ID | |
161 | * @param msg_subtype message subtype | |
162 | * @param src_imv_id source IMV ID | |
163 | * @param dst_imc_id destination IMC ID | |
e6b6fc88 AS |
164 | */ |
165 | void (*receive_message)(imc_manager_t *this, | |
166 | TNC_ConnectionID connection_id, | |
584282d7 AS |
167 | bool excl, |
168 | TNC_BufferReference msg, | |
169 | TNC_UInt32 msg_len, | |
170 | TNC_VendorID msg_vid, | |
171 | TNC_MessageSubtype msg_subtype, | |
172 | TNC_UInt32 src_imv_id, | |
173 | TNC_UInt32 dst_imc_id); | |
e6b6fc88 | 174 | |
d599902a AS |
175 | /** |
176 | * Notify all IMCs that all IMV messages received in a batch have been | |
177 | * delivered and this is the IMCs last chance to send a message in the | |
178 | * batch of IMC messages currently being collected. | |
179 | * | |
180 | * @param id connection ID | |
181 | */ | |
182 | void (*batch_ending)(imc_manager_t *this, TNC_ConnectionID id); | |
183 | ||
b2563331 AS |
184 | /** |
185 | * Destroy an IMC manager and all its controlled instances. | |
186 | */ | |
187 | void (*destroy)(imc_manager_t *this); | |
188 | }; | |
189 | ||
190 | #endif /** IMC_MANAGER_H_ @}*/ |