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