implemented the RFC 5792 PA-TNC protocol and an example IMC/IMV pair
[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 <tnc/tncifimc.h>
27 #include <tnc/pen/pen.h>
28 #include <library.h>
29
30 typedef struct imc_agent_t imc_agent_t;
31
32 /**
33 * Core functions of an Integrity Measurement Verifier (IMC)
34 */
35 struct imc_agent_t {
36
37 /**
38 * Ask a TNCC to retry an Integrity Check Handshake
39 *
40 * @param imc_id IMC ID assigned by TNCC
41 * @param connection_id network connection ID assigned by TNCC
42 * @param reason IMC retry reason
43 * @return TNC result code
44 */
45 TNC_Result (*request_handshake_retry)(TNC_IMCID imc_id,
46 TNC_ConnectionID connection_id,
47 TNC_RetryReason reason);
48
49 /**
50 * Bind TNCC functions
51 *
52 * @param bind_function function offered by the TNCC
53 * @return TNC result code
54 */
55 TNC_Result (*bind_functions)(imc_agent_t *this,
56 TNC_TNCC_BindFunctionPointer bind_function);
57
58 /**
59 * Create the IMC state for a TNCCS connection instance
60 *
61 * @param state internal IMC state instance
62 * @return TNC result code
63 */
64 TNC_Result (*create_state)(imc_agent_t *this, imc_state_t *state);
65
66 /**
67 * Delete the IMC state for a TNCCS connection instance
68 *
69 * @param connection_id network connection ID assigned by TNCS
70 * @return TNC result code
71 */
72 TNC_Result (*delete_state)(imc_agent_t *this,
73 TNC_ConnectionID connection_id);
74
75 /**
76 * Change the current state of a TNCCS connection
77 *
78 * @param connection_id network connection ID assigned by TNCS
79 * @param new_state new state of TNCCS connection
80 * @return TNC result code
81 */
82 TNC_Result (*change_state)(imc_agent_t *this,
83 TNC_ConnectionID connection_id,
84 TNC_ConnectionState new_state);
85
86 /**
87 * Get the IMC state for a TNCCS connection instance
88 *
89 * @param connection_id network connection ID assigned by TNCS
90 * @param state internal IMC state instance
91 * @return TRUE if the state was found
92 */
93 bool (*get_state)(imc_agent_t *this,
94 TNC_ConnectionID connection_id, imc_state_t **state);
95
96 /**
97 * Call when an IMC-IMV message is to be sent
98 *
99 * @param connection_id network connection ID assigned by TNCC
100 * @param msg message to send
101 * @return TNC result code
102 */
103 TNC_Result (*send_message)(imc_agent_t *this,
104 TNC_ConnectionID connection_id,
105 chunk_t msg);
106
107 /**
108 * Destroys an imc_agent_t object
109 */
110 void (*destroy)(imc_agent_t *this);
111 };
112
113 /**
114 * Create an imc_agent_t object
115 *
116 * @param name name of the IMC
117 * @param vendor_id vendor ID of the IMC
118 * @param subtype message subtype of the IMC
119 * @param id ID of the IMC as assigned by the TNCS
120 * @param actual_version actual version of the IF-IMC API
121 *
122 */
123 imc_agent_t *imc_agent_create(const char *name,
124 pen_t vendor_id, u_int32_t subtype,
125 TNC_IMCID id, TNC_Version *actual_version);
126
127 #endif /** IMC_AGENT_H_ @}*/