Moved all functionality into imv_os_agent_t class turning imv_os_t into an IF-IMV...
[strongswan.git] / src / libimcv / plugins / imv_os / imv_os_agent.h
1 /*
2 * Copyright (C) 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_os_agent_t imv_os_agent
18 * @{ @ingroup imv_os
19 */
20
21 #ifndef IMV_OS_AGENT_H_
22 #define IMV_OS_AGENT_H_
23
24 #include <imv/imv_state.h>
25 #include <imv/imv_msg.h>
26
27 #include <tncif.h>
28
29 typedef struct imv_os_agent_t imv_os_agent_t;
30
31 /**
32 * Public interface of the OS IMV agent
33 */
34 struct imv_os_agent_t {
35
36 /**
37 * Implements the TNC_IMV_ProvideBindFunction function of the OS IMV
38 *
39 * @param bind_function Function offered by the TNCS
40 * @return TNC result code
41 */
42 TNC_Result (*bind_functions)(imv_os_agent_t *this,
43 TNC_TNCS_BindFunctionPointer bind_function);
44
45 /**
46 * Implements the TNC_IMV_NotifyConnectionChange() function of the OS IMV
47 *
48 * @param id Network connection ID assigned by TNCS
49 * @param new_state New connection state to be set
50 * @return TNC result code
51 */
52 TNC_Result (*notify_connection_change)(imv_os_agent_t *this,
53 TNC_ConnectionID id,
54 TNC_ConnectionState new_state);
55
56 /**
57 * Implements the TNC_IMV_ReceiveMessage() function of the OS IMV
58 *
59 * @param id Network connection ID assigned by TNCS
60 * @param msg_type PA-TNC message type
61 * @param msg Received message
62 * @return TNC result code
63 */
64 TNC_Result (*receive_message)(imv_os_agent_t *this, TNC_ConnectionID id,
65 TNC_MessageType msg_type, chunk_t msg);
66
67 /**
68 * Implements the TNC_IMV_ReceiveMessageLong() function of the OS IMV
69 *
70 * @param id Network connection ID assigned by TNCS
71 * @param src_imc_id ID of source IMC
72 * @param dst_imv_id ID of destination IMV
73 * @param msg_vid Vendor ID of message type
74 * @param msg_subtype PA-TNC message subtype
75 * @param msg Received message
76 * @return TNC result code
77 */
78 TNC_Result (*receive_message_long)(imv_os_agent_t *this,
79 TNC_ConnectionID id,
80 TNC_UInt32 src_imc_id,
81 TNC_UInt32 dst_imv_id,
82 TNC_VendorID msg_vid,
83 TNC_MessageSubtype msg_subtype,
84 chunk_t msg);
85
86 /**
87 * Implements the TNC_IMV_BatchEnding() function of the OS IMV
88 *
89 * @param id Network connection ID assigned by TNCS
90 * @return TNC result code
91 */
92 TNC_Result (*batch_ending)(imv_os_agent_t *this, TNC_ConnectionID id);
93
94 /**
95 * Implements the TNC_IMV_SolicitRecommendation() function of the OS IMV
96 *
97 * @param id Network connection ID assigned by TNCS
98 * @return TNC result code
99 */
100 TNC_Result (*solicit_recommendation)(imv_os_agent_t *this,
101 TNC_ConnectionID id);
102
103 /**
104 * Destroys an imv_os_agent_t object
105 */
106 void (*destroy)(imv_os_agent_t *this);
107
108 };
109
110 /**
111 * Creates the an OS IMV agent
112 *
113 * @param name Name of the IMV
114 * @param id ID of the IMV
115 * @param actual_version TNC IF-IMV version
116 */
117 imv_os_agent_t* imv_os_agent_create(const char* name, TNC_IMVID id,
118 TNC_Version *actual_version);
119
120 #endif /** IMV_OS_AGENT_H_ @}*/