2 * Copyright (C) 2012 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup imc_msg imc_msg
24 #include <imc/imc_agent.h>
26 typedef struct imc_msg_t imc_msg_t
;
31 * Interface for a PA-TNC message handled by an IMC.
37 * Get source ID of PA-TNC message
41 TNC_UInt32 (*get_src_id
)(imc_msg_t
*this);
44 * Get destination ID of PA-TNC message
46 * @return destination ID
48 TNC_UInt32 (*get_dst_id
)(imc_msg_t
*this);
51 * Sends one or multiple PA-TNC messages
53 * @param excl set the excl message flag if supported
54 * @return TNC result code
56 TNC_Result (*send
)(imc_msg_t
*this, bool excl
);
59 * Processes a received PA-TNC message
61 * @param fatal_error TRUE if IMV sent a fatal error message
62 * @return TNC result code
64 TNC_Result (*receive
)(imc_msg_t
*this, bool *fatal_error
);
67 * Add a PA-TNC attribute to the send queue
69 * @param attr PA-TNC attribute to be added
71 void (*add_attribute
)(imc_msg_t
*this, pa_tnc_attr_t
*attr
);
74 * Enumerator over PA-TNC attributes contained in the PA-TNC message
76 * @return PA-TNC attribute enumerator
78 enumerator_t
* (*create_attribute_enumerator
)(imc_msg_t
*this);
81 * Get the encoding of the IMC message.
83 * @return message encoding, internal data
85 chunk_t (*get_encoding
)(imc_msg_t
*this);
88 * Destroys a imc_msg_t object.
90 void (*destroy
)(imc_msg_t
*this);
94 * Create a wrapper for an outbound message
96 * @param agent IMC agent responsible for the message
97 * @param state IMC state for the given connection ID
98 * @param connection_id connection ID
99 * @param src_id source IMC ID
100 * @param dst_id destination IMV ID
101 * @param msg_type PA-TNC message type
103 imc_msg_t
* imc_msg_create(imc_agent_t
*agent
, imc_state_t
*state
,
104 TNC_ConnectionID connection_id
,
105 TNC_UInt32 src_id
, TNC_UInt32 dst_id
,
106 pen_type_t msg_type
);
109 * Create a wrapper for an outbound message based on a received message
111 * @param msg received message the reply is based on
113 imc_msg_t
* imc_msg_create_as_reply(imc_msg_t
*msg
);
116 * Create a wrapper around message data received via the legacy IF-IMC interface
118 * @param agent IMC agent responsible for the message
119 * @param state IMC state for the given connection ID
120 * @param connection_id connection ID
121 * @param msg_type PA-TNC message type
122 * @param msg received PA-TNC message blob
124 imc_msg_t
* imc_msg_create_from_data(imc_agent_t
*agent
, imc_state_t
*state
,
125 TNC_ConnectionID connection_id
,
126 TNC_MessageType msg_type
,
130 * Create a wrapper around message data received via the long IF-IMC interface
132 * @param agent IMC agent responsible for the message
133 * @param state IMC state for the given connection ID
134 * @param connection_id connection ID
135 * @param src_id source IMV ID
136 * @param dst_id destination IMC ID
137 * @param msg_flags PA-TNC message flags
138 * @param msg_vid PA-TNC message vendor ID
139 * @param msg_subtype PA-TNC subtype
140 * @param msg received PA-TNC message blob
142 imc_msg_t
* imc_msg_create_from_long_data(imc_agent_t
*agent
, imc_state_t
*state
,
143 TNC_ConnectionID connection_id
,
144 TNC_UInt32 src_id
, TNC_UInt32 dst_id
,
145 TNC_VendorID msg_vid
,
146 TNC_MessageSubtype msg_subtype
,
149 #endif /** IMC_MSG_H_ @}*/