Annotation of embedaddon/strongswan/src/libimcv/imc/imc_agent.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2011-2014 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: *
18: * @defgroup imc_agent_t imc_agent
19: * @{ @ingroup libimcv_imc
20: */
21:
22: #ifndef IMC_AGENT_H_
23: #define IMC_AGENT_H_
24:
25: #include "imc_state.h"
26: #include "pa_tnc/pa_tnc_msg.h"
27:
28: #include <tncifimc.h>
29: #include <pen/pen.h>
30: #include <collections/linked_list.h>
31:
32: #include <library.h>
33:
34: typedef struct imc_agent_t imc_agent_t;
35:
36: /**
37: * Core functions of an Integrity Measurement Verifier (IMC)
38: */
39: struct imc_agent_t {
40:
41: /**
42: * Ask a TNCC to retry an Integrity Check Handshake
43: *
44: * @param imc_id IMC ID assigned by TNCC
45: * @param connection_id network connection ID assigned by TNCC
46: * @param reason IMC retry reason
47: * @return TNC result code
48: */
49: TNC_Result (*request_handshake_retry)(TNC_IMCID imc_id,
50: TNC_ConnectionID connection_id,
51: TNC_RetryReason reason);
52:
53: /**
54: * Call when an IMC-IMC message is to be sent
55: *
56: * @param imc_id IMC ID assigned by TNCC
57: * @param connection_id network connection ID assigned by TNCC
58: * @param msg message to send
59: * @param msg_len message length in bytes
60: * @param msg_type message type
61: * @return TNC result code
62: */
63: TNC_Result (*send_message)(TNC_IMCID imc_id,
64: TNC_ConnectionID connection_id,
65: TNC_BufferReference msg,
66: TNC_UInt32 msg_len,
67: TNC_MessageType msg_type);
68:
69: /**
70: * Call when an IMC-IMC message is to be sent with long message types
71: *
72: * @param imc_id IMC ID assigned by TNCC
73: * @param connection_id network connection ID assigned by TNCC
74: * @param msg_flags message flags
75: * @param msg message to send
76: * @param msg_len message length in bytes
77: * @param msg_vid message vendor ID
78: * @param msg_subtype message subtype
79: * @param dst_imc_id destination IMV ID
80: * @return TNC result code
81: */
82: TNC_Result (*send_message_long)(TNC_IMCID imc_id,
83: TNC_ConnectionID connection_id,
84: TNC_UInt32 msg_flags,
85: TNC_BufferReference msg,
86: TNC_UInt32 msg_len,
87: TNC_VendorID msg_vid,
88: TNC_MessageSubtype msg_subtype,
89: TNC_UInt32 dst_imv_id);
90:
91: /**
92: * Bind TNCC functions
93: *
94: * @param bind_function function offered by the TNCC
95: * @return TNC result code
96: */
97: TNC_Result (*bind_functions)(imc_agent_t *this,
98: TNC_TNCC_BindFunctionPointer bind_function);
99:
100: /**
101: * Create the IMC state for a TNCCS connection instance
102: *
103: * @param state internal IMC state instance
104: * @return TNC result code
105: */
106: TNC_Result (*create_state)(imc_agent_t *this, imc_state_t *state);
107:
108: /**
109: * Delete the IMC state for a TNCCS connection instance
110: *
111: * @param connection_id network connection ID assigned by TNCS
112: * @return TNC result code
113: */
114: TNC_Result (*delete_state)(imc_agent_t *this,
115: TNC_ConnectionID connection_id);
116:
117: /**
118: * Change the current state of a TNCCS connection
119: *
120: * @param connection_id network connection ID assigned by TNCS
121: * @param new_state new state of TNCCS connection
122: * @param state_p internal IMC state instance [optional argument]
123: * @return TNC result code
124: */
125: TNC_Result (*change_state)(imc_agent_t *this,
126: TNC_ConnectionID connection_id,
127: TNC_ConnectionState new_state,
128: imc_state_t **state_p);
129:
130: /**
131: * Get the IMC state for a TNCCS connection instance
132: *
133: * @param connection_id network connection ID assigned by TNCS
134: * @param state internal IMC state instance
135: * @return TRUE if the state was found
136: */
137: bool (*get_state)(imc_agent_t *this,
138: TNC_ConnectionID connection_id, imc_state_t **state);
139:
140: /**
141: * Get IMC name
142: *
143: * return IMC name
144: */
145: const char* (*get_name)(imc_agent_t *this);
146:
147: /**
148: * Get base IMC ID
149: *
150: * return base IMC ID
151: */
152: TNC_IMCID (*get_id)(imc_agent_t *this);
153:
154: /**
155: * Reserve additional IMC IDs from TNCC
156: *
157: * @param count number of additional IMC IDs to be assigned
158: * @return TNC result code
159: */
160: TNC_Result (*reserve_additional_ids)(imc_agent_t *this, int count);
161:
162: /**
163: * Return the number of additional IMC IDs assigned by the TNCC
164: *
165: * @return number of additional IMC IDs
166: */
167: int (*count_additional_ids)(imc_agent_t *this);
168:
169: /**
170: * Create an enumerator for the additional IMC IDs
171: */
172: enumerator_t* (*create_id_enumerator)(imc_agent_t *this);
173:
174: /**
175: * Add an item to the list of non-fatal unsupported PA-TNC attribute types
176: */
177: void (*add_non_fatal_attr_type)(imc_agent_t *this, pen_type_t type);
178:
179: /**
180: * Get a list of non-fatal unsupported PA-TNC attribute types
181: */
182: linked_list_t* (*get_non_fatal_attr_types)(imc_agent_t *this);
183:
184: /**
185: * Is the transport protocol PT-TLS?
186: *
187: * return TRUE if PT-TLS
188: */
189: bool (*has_pt_tls)(imc_agent_t *this);
190:
191: /**
192: * Destroys an imc_agent_t object
193: */
194: void (*destroy)(imc_agent_t *this);
195: };
196:
197: /**
198: * Create an imc_agent_t object
199: *
200: * @param name name of the IMC
201: * @param supported_types list of message types registered by the IMC
202: * @param type_count number of registered message types
203: * @param id ID of the IMC as assigned by the TNCS
204: * @param actual_version actual version of the IF-IMC API
205: *
206: */
207: imc_agent_t *imc_agent_create(const char *name,
208: pen_type_t *supported_types, uint32_t type_count,
209: TNC_IMCID id, TNC_Version *actual_version);
210:
211: #endif /** IMC_AGENT_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>