]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libcharon/tnc/imv/imv_manager.h
b5c581a7538d174e2d130d3fa912db5929111f3f
[thirdparty/strongswan.git] / src / libcharon / tnc / imv / imv_manager.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_manager imv_manager
18 * @{ @ingroup imv
19 */
20
21 #ifndef IMV_MANAGER_H_
22 #define IMV_MANAGER_H_
23
24 #include "imv.h"
25 #include "imv_recommendations.h"
26
27 #include <library.h>
28
29 typedef struct imv_manager_t imv_manager_t;
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 * Get the configured recommendation policy
54 *
55 * @return configured recommendation policy
56 */
57 recommendation_policy_t (*get_recommendation_policy)(imv_manager_t *this);
58
59 /**
60 * Create an empty set of IMV recommendations and evaluations
61 *
62 * @return instance of a recommendations_t list
63 */
64 recommendations_t* (*create_recommendations)(imv_manager_t *this);
65
66 /**
67 * Enforce the TNC recommendation on the IKE_SA by either inserting an
68 * allow|isolate group membership rule (TRUE) or by blocking access (FALSE)
69 *
70 * @param void TNC action recommendation
71 * @return TRUE for allow|isolate, FALSE for none
72 */
73 bool (*enforce_recommendation)(imv_manager_t *this,
74 TNC_IMV_Action_Recommendation rec);
75
76 /**
77 * Notify all IMV instances
78 *
79 * @param state communicate the state a connection has reached
80 */
81 void (*notify_connection_change)(imv_manager_t *this,
82 TNC_ConnectionID id,
83 TNC_ConnectionState state);
84
85 /**
86 * Sets the supported message types reported by a given IMV
87 *
88 * @param id ID of reporting IMV
89 * @param supported_types list of messages type supported by IMV
90 * @param type_count number of supported message types
91 * @return TNC result code
92 */
93 TNC_Result (*set_message_types)(imv_manager_t *this,
94 TNC_IMVID id,
95 TNC_MessageTypeList supported_types,
96 TNC_UInt32 type_count);
97
98 /**
99 * Solicit recommendations from IMVs that have not yet provided one
100 *
101 * @param id connection ID
102 */
103 void (*solicit_recommendation)(imv_manager_t *this, TNC_ConnectionID id);
104
105 /**
106 * Delivers a message to interested IMVs.
107 *
108 * @param connection_id ID of connection over which message was received
109 * @param message message
110 * @param message_len message length
111 * @param message_type message type
112 */
113 void (*receive_message)(imv_manager_t *this,
114 TNC_ConnectionID connection_id,
115 TNC_BufferReference message,
116 TNC_UInt32 message_len,
117 TNC_MessageType message_type);
118
119 /**
120 * Notify all IMVs that all IMC messages received in a batch have been
121 * delivered and this is the IMVs last chance to send a message in the
122 * batch of IMV messages currently being collected.
123 *
124 * @param id connection ID
125 */
126 void (*batch_ending)(imv_manager_t *this, TNC_ConnectionID id);
127
128 /**
129 * Destroy an IMV manager and all its controlled instances.
130 */
131 void (*destroy)(imv_manager_t *this);
132 };
133
134 #endif /** IMV_MANAGER_H_ @}*/