refactored PA-TNC message handling by IMVs

This commit is contained in:
Andreas Steffen
2012-10-17 23:15:14 +02:00
parent f8a70254a9
commit 6a61b79583
14 changed files with 1000 additions and 625 deletions
+54 -61
View File
@@ -50,6 +50,44 @@ struct imv_agent_t {
TNC_ConnectionID connection_id,
TNC_RetryReason reason);
/**
* Call when an IMV-IMC message is to be sent
*
* @param imv_id IMV ID assigned by TNCS
* @param connection_id network connection ID assigned by TNCS
* @param msg message to send
* @param msg_len message length in bytes
* @param msg_type message type
* @return TNC result code
*/
TNC_Result (*send_message)(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
TNC_BufferReference msg,
TNC_UInt32 msg_len,
TNC_MessageType msg_type);
/**
* Call when an IMV-IMC message is to be sent with long message types
*
* @param imv_id IMV ID assigned by TNCS
* @param connection_id network connection ID assigned by TNCS
* @param msg_flags message flags
* @param msg message to send
* @param msg_len message length in bytes
* @param msg_vid message vendor ID
* @param msg_subtype message subtype
* @param dst_imc_id destination IMC ID
* @return TNC result code
*/
TNC_Result (*send_message_long)(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
TNC_UInt32 msg_flags,
TNC_BufferReference msg,
TNC_UInt32 msg_len,
TNC_VendorID msg_vid,
TNC_MessageSubtype msg_subtype,
TNC_UInt32 dst_imc_id);
/**
* Bind TNCS functions
*
@@ -99,72 +137,27 @@ struct imv_agent_t {
bool (*get_state)(imv_agent_t *this,
TNC_ConnectionID connection_id, imv_state_t **state);
/**
* Call when a PA-TNC message is to be sent
*
* @param connection_id network connection ID assigned by TNCS
* @param excl exclusive flag
* @param src_imv_id IMV ID to be set as source
* @param dst_imc_id IMD ID to be set as destination
* @param msg_vid message vendor ID
* @param msg_subtype message subtype
* @param attr_list list of PA-TNC attributes to send
* @return TNC result code
*/
TNC_Result (*send_message)(imv_agent_t *this,
TNC_ConnectionID connection_id, bool excl,
TNC_UInt32 src_imv_id, TNC_UInt32 dst_imc_id,
TNC_VendorID msg_vid,
TNC_MessageSubtype msg_subtype,
linked_list_t *attr_list);
/**
* Call when a PA-TNC message was received
*
* @param state state for current connection
* @param msg received unparsed message
* @param msg_vid message vendorID of the received message
* @param msg_subtype message subtype of the received message
* @param src_imc_id source IMC ID
* @param dst_imv_id destination IMV ID
* @param pa_tnc_message parsed PA-TNC message or NULL if an error occurred
* @return TNC result code
*/
TNC_Result (*receive_message)(imv_agent_t *this,
imv_state_t *state, chunk_t msg,
TNC_VendorID msg_vid,
TNC_MessageSubtype msg_subtype,
TNC_UInt32 src_imc_id,
TNC_UInt32 dst_imv_id,
pa_tnc_msg_t **pa_tnc_msg);
/**
* Set Action Recommendation and Evaluation Result in the IMV state
*
* @param connection_id network connection ID assigned by TNCS
* @param rec IMV action recommendation
* @param eval IMV evaluation result
* @return TNC result code
*/
TNC_Result (*set_recommendation)(imv_agent_t *this,
TNC_ConnectionID connection_id,
TNC_IMV_Action_Recommendation rec,
TNC_IMV_Evaluation_Result eval);
/**
* Deliver IMV Action Recommendation and IMV Evaluation Result to the TNCS
*
* @param connection_id network connection ID assigned by TNCS
* @param dst_imc_id IMD ID to be set as destination
* @param msg_vid message vendor ID
* @param msg_subtype message subtype
* @param state state bound to a connection ID
* @return TNC result code
*/
TNC_Result (*provide_recommendation)(imv_agent_t *this,
TNC_ConnectionID connection_id,
TNC_UInt32 dst_imc_id,
TNC_VendorID msg_vid,
TNC_MessageSubtype msg_subtype);
TNC_Result (*provide_recommendation)(imv_agent_t *this, imv_state_t* state);
/**
* Get IMV name
*
* return IMV name
*/
const char* (*get_name)(imv_agent_t *this);
/**
* Get base IMV ID
*
* return base IMV ID
*/
TNC_IMVID (*get_id)(imv_agent_t *this);
/**
* Reserve additional IMV IDs from TNCS