Annotation of embedaddon/strongswan/src/libtnccs/tnc/imv/imv_manager.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2010-2013 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_manager imv_manager
18: * @{ @ingroup imv
19: */
20:
21: #ifndef IMV_MANAGER_H_
22: #define IMV_MANAGER_H_
23:
24: typedef struct imv_manager_t imv_manager_t;
25:
26: #include "imv.h"
27: #include "imv_recommendations.h"
28:
29: #include <library.h>
30:
31: /**
32: * The IMV manager controls all IMV instances.
33: */
34: struct imv_manager_t {
35:
36: /**
37: * Add an IMV instance
38: *
39: * @param imv IMV instance
40: * @return TRUE if initialization successful
41: */
42: bool (*add)(imv_manager_t *this, imv_t *imv);
43:
44: /**
45: * Remove an IMV instance from the list and return it
46: *
47: * @param id ID of IMV instance
48: * @return removed IMC instance
49: */
50: imv_t* (*remove)(imv_manager_t *this, TNC_IMVID id);
51:
52: /**
53: * Load and initialize an IMV as a dynamic library and add it to the list
54: *
55: * @param name name of the IMV to be loaded
56: * @param path path of the IMV dynamic library file
57: * @return TRUE if loading succeeded
58: */
59: bool (*load)(imv_manager_t *this, char *name, char *path);
60:
61: /**
62: * Load and initialize an IMV from a set of TNC IMC functions.
63: *
64: * @param name name of the IMV
65: * @param initialize TNC_IMV_InitializePointer
66: * @param notify_connection_change TNC_IMV_NotifyConnectionChangePointer
67: * @param receive_message TNC_IMV_ReceiveMessagePointer
68: * @param receive_message_long TNC_IMV_ReceiveMessageLongPointer
69: * @param solicit_recommendation TNC_IMV_SolicitRecommendationPointer
70: * @param batch_ending TNC_IMV_BatchEndingPointer
71: * @param terminate TNC_IMV_TerminatePointer
72: * @param provide_bind_function TNC_IMV_ProvideBindFunctionPointer
73: * @return TRUE if loading succeeded
74: */
75: bool (*load_from_functions)(imv_manager_t *this, char *name,
76: TNC_IMV_InitializePointer initialize,
77: TNC_IMV_NotifyConnectionChangePointer notify_connection_change,
78: TNC_IMV_ReceiveMessagePointer receive_message,
79: TNC_IMV_ReceiveMessageLongPointer receive_message_long,
80: TNC_IMV_SolicitRecommendationPointer solicit_recommendation,
81: TNC_IMV_BatchEndingPointer batch_ending,
82: TNC_IMV_TerminatePointer terminate,
83: TNC_IMV_ProvideBindFunctionPointer provide_bind_function);
84:
85: /**
86: * Check if an IMV with a given ID is registered with the IMV manager
87: *
88: * @param id ID of IMV instance
89: * @return TRUE if registered
90: */
91: bool (*is_registered)(imv_manager_t *this, TNC_IMVID id);
92:
93: /**
94: * Reserve an additional ID for an IMV
95: *
96: * @param id ID of IMV instance
97: * @param new_id reserved ID assigned to IMV
98: * @return TRUE if primary IMV ID was used
99: */
100: bool (*reserve_id)(imv_manager_t *this, TNC_IMVID id, TNC_UInt32 *new_id);
101:
102: /**
103: * Get the configured recommendation policy
104: *
105: * @return configured recommendation policy
106: */
107: recommendation_policy_t (*get_recommendation_policy)(imv_manager_t *this);
108:
109: /**
110: * Create an empty set of IMV recommendations and evaluations
111: *
112: * @return instance of a recommendations_t list
113: */
114: recommendations_t* (*create_recommendations)(imv_manager_t *this);
115:
116: /**
117: * Notify all IMV instances
118: *
119: * @param state communicate the state a connection has reached
120: */
121: void (*notify_connection_change)(imv_manager_t *this,
122: TNC_ConnectionID id,
123: TNC_ConnectionState state);
124:
125: /**
126: * Sets the supported message types reported by a given IMV
127: *
128: * @param id ID of reporting IMV
129: * @param supported_types list of messages type supported by IMV
130: * @param type_count number of supported message types
131: * @return TNC result code
132: */
133: TNC_Result (*set_message_types)(imv_manager_t *this,
134: TNC_IMVID id,
135: TNC_MessageTypeList supported_types,
136: TNC_UInt32 type_count);
137:
138: /**
139: * Sets the supported long message types reported by a given IMV
140: *
141: * @param id ID of reporting IMV
142: * @param supported_vids list of vendor IDs supported by IMV
143: * @param supported_subtypes list of messages type supported by IMV
144: * @param type_count number of supported message types
145: * @return TNC result code
146: */
147: TNC_Result (*set_message_types_long)(imv_manager_t *this,
148: TNC_IMVID id,
149: TNC_VendorIDList supported_vids,
150: TNC_MessageSubtypeList supported_subtypes,
151: TNC_UInt32 type_count);
152:
153: /**
154: * Solicit recommendations from IMVs that have not yet provided one
155: *
156: * @param id connection ID
157: */
158: void (*solicit_recommendation)(imv_manager_t *this, TNC_ConnectionID id);
159:
160: /**
161: * Delivers a message to interested IMVs.
162: *
163: * @param connection_id connection ID
164: * @param excl exclusive message flag
165: * @param msg message
166: * @param msg_len message length
167: * @param msg_vid message Vendor ID
168: * @param msg_subtype message subtype
169: * @param src_imc_id source IMC ID
170: * @param dst_imv_id destination IMV ID
171: */
172: void (*receive_message)(imv_manager_t *this,
173: TNC_ConnectionID connection_id,
174: bool excl,
175: TNC_BufferReference msg,
176: TNC_UInt32 msg_len,
177: TNC_VendorID msg_vid,
178: TNC_MessageSubtype msg_subtype,
179: TNC_UInt32 src_imc_id,
180: TNC_UInt32 dst_imv_id);
181:
182: /**
183: * Notify all IMVs that all IMC messages received in a batch have been
184: * delivered and this is the IMVs last chance to send a message in the
185: * batch of IMV messages currently being collected.
186: *
187: * @param id connection ID
188: */
189: void (*batch_ending)(imv_manager_t *this, TNC_ConnectionID id);
190:
191: /**
192: * Destroy an IMV manager and all its controlled instances.
193: */
194: void (*destroy)(imv_manager_t *this);
195: };
196:
197: #endif /** IMV_MANAGER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>