initialize libstrongswan in dynamic stand-alone libimcv-based libraries
[strongswan.git] / src / libimcv / imc / imc_agent.h
1 /*
2 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15 /**
16 *
17 * @defgroup imc_agent_t imc_agent
18 * @{ @ingroup imc_agent
19 */
20
21 #ifndef IMC_AGENT_H_
22 #define IMC_AGENT_H_
23
24 #include "imc_state.h"
25
26 #include <tncifimc.h>
27 #include <pen/pen.h>
28
29 #include <library.h>
30
31 typedef struct imc_agent_t imc_agent_t;
32
33 /**
34 * Core functions of an Integrity Measurement Verifier (IMC)
35 */
36 struct imc_agent_t {
37
38 /**
39 * Ask a TNCC to retry an Integrity Check Handshake
40 *
41 * @param imc_id IMC ID assigned by TNCC
42 * @param connection_id network connection ID assigned by TNCC
43 * @param reason IMC retry reason
44 * @return TNC result code
45 */
46 TNC_Result (*request_handshake_retry)(TNC_IMCID imc_id,
47 TNC_ConnectionID connection_id,
48 TNC_RetryReason reason);
49
50 /**
51 * Bind TNCC functions
52 *
53 * @param bind_function function offered by the TNCC
54 * @return TNC result code
55 */
56 TNC_Result (*bind_functions)(imc_agent_t *this,
57 TNC_TNCC_BindFunctionPointer bind_function);
58
59 /**
60 * Create the IMC state for a TNCCS connection instance
61 *
62 * @param state internal IMC state instance
63 * @return TNC result code
64 */
65 TNC_Result (*create_state)(imc_agent_t *this, imc_state_t *state);
66
67 /**
68 * Delete the IMC state for a TNCCS connection instance
69 *
70 * @param connection_id network connection ID assigned by TNCS
71 * @return TNC result code
72 */
73 TNC_Result (*delete_state)(imc_agent_t *this,
74 TNC_ConnectionID connection_id);
75
76 /**
77 * Change the current state of a TNCCS connection
78 *
79 * @param connection_id network connection ID assigned by TNCS
80 * @param new_state new state of TNCCS connection
81 * @return TNC result code
82 */
83 TNC_Result (*change_state)(imc_agent_t *this,
84 TNC_ConnectionID connection_id,
85 TNC_ConnectionState new_state);
86
87 /**
88 * Get the IMC state for a TNCCS connection instance
89 *
90 * @param connection_id network connection ID assigned by TNCS
91 * @param state internal IMC state instance
92 * @return TRUE if the state was found
93 */
94 bool (*get_state)(imc_agent_t *this,
95 TNC_ConnectionID connection_id, imc_state_t **state);
96
97 /**
98 * Call when an IMC-IMV message is to be sent
99 *
100 * @param connection_id network connection ID assigned by TNCC
101 * @param msg message to send
102 * @return TNC result code
103 */
104 TNC_Result (*send_message)(imc_agent_t *this,
105 TNC_ConnectionID connection_id,
106 chunk_t msg);
107
108 /**
109 * Destroys an imc_agent_t object
110 */
111 void (*destroy)(imc_agent_t *this);
112 };
113
114 /**
115 * Create an imc_agent_t object
116 *
117 * @param name name of the IMC
118 * @param vendor_id vendor ID of the IMC
119 * @param subtype message subtype of the IMC
120 * @param id ID of the IMC as assigned by the TNCS
121 * @param actual_version actual version of the IF-IMC API
122 *
123 */
124 imc_agent_t *imc_agent_create(const char *name,
125 pen_t vendor_id, u_int32_t subtype,
126 TNC_IMCID id, TNC_Version *actual_version);
127
128 #endif /** IMC_AGENT_H_ @}*/