}
this->public.receive_message =
dlsym(this->handle, "TNC_IMV_ReceiveMessage");
+ this->public.receive_message_long =
+ dlsym(this->handle, "TNC_IMV_ReceiveMessageLong");
this->public.batch_ending =
dlsym(this->handle, "TNC_IMV_BatchEnding");
this->public.terminate =
}
METHOD(imc_agent_t, receive_message, TNC_Result,
- private_imc_agent_t *this, TNC_ConnectionID connection_id, chunk_t msg,
- TNC_MessageType msg_type, pa_tnc_msg_t **pa_tnc_msg)
+ private_imc_agent_t *this, imc_state_t *state, chunk_t msg,
+ TNC_VendorID msg_vid, TNC_MessageSubtype msg_subtype,
+ TNC_UInt32 src_imv_id, TNC_UInt32 dst_imc_id, pa_tnc_msg_t **pa_tnc_msg)
{
pa_tnc_msg_t *pa_msg, *error_msg;
pa_tnc_attr_t *error_attr;
enumerator_t *enumerator;
+ TNC_MessageType msg_type;
+ TNC_UInt32 msg_flags, src_imc_id, dst_imv_id;
+ TNC_ConnectionID connection_id;
TNC_Result result;
- DBG2(DBG_IMV, "IMC %u \"%s\" received message type 0x%08x for Connection ID %u",
- this->id, this->name, msg_type, connection_id);
+ connection_id = state->get_connection_id(state);
+
+ if (state->has_long(state))
+ {
+ if (dst_imc_id != TNC_IMCID_ANY)
+ {
+ DBG2(DBG_IMC, "IMC %u \"%s\" received message for Connection ID %u "
+ "from IMV %u to IMC %u", this->id, this->name,
+ connection_id, src_imv_id, dst_imc_id);
+ }
+ else
+ {
+ DBG2(DBG_IMC, "IMC %u \"%s\" received message for Connection ID %u "
+ "from IMV %u", this->id, this->name, connection_id,
+ src_imv_id);
+ }
+ }
+ else
+ {
+ DBG2(DBG_IMC, "IMC %u \"%s\" received message for Connection ID %u",
+ this->id, this->name, connection_id);
+ }
*pa_tnc_msg = NULL;
pa_msg = pa_tnc_msg_create_from_data(msg);
*pa_tnc_msg = pa_msg;
break;
case VERIFY_ERROR:
- if (!this->send_message)
- {
- /* TNCC doen't have a SendMessage() function */
- return TNC_RESULT_FATAL;
- }
-
/* build error message */
error_msg = pa_tnc_msg_create();
enumerator = pa_msg->create_error_enumerator(pa_msg);
error_msg->build(error_msg);
/* send error message */
- msg = error_msg->get_encoding(error_msg);
- result = this->send_message(this->id, connection_id,
+ if (state->has_long(state) && this->send_message_long)
+ {
+ if (state->has_excl(state))
+ {
+ msg_flags = TNC_MESSAGE_FLAGS_EXCLUSIVE;
+ dst_imv_id = src_imv_id;
+ }
+ else
+ {
+ msg_flags = 0;
+ dst_imv_id = TNC_IMVID_ANY;
+ }
+ src_imc_id = (dst_imc_id == TNC_IMCID_ANY) ? this->id
+ : dst_imc_id;
+
+ result = this->send_message_long(src_imc_id, connection_id,
+ msg_flags, msg.ptr, msg.len, msg_vid,
+ msg_subtype, dst_imv_id);
+ }
+ else if (this->send_message)
+ {
+ msg_type = (msg_vid << 8) | msg_subtype;
+
+ result = this->send_message(this->id, connection_id,
msg.ptr, msg.len, msg_type);
+ }
+ else
+ {
+ result = TNC_RESULT_FATAL;
+ }
/* clean up */
error_msg->destroy(error_msg);
/**
* Call when a PA-TNC message was received
*
- * @param connection_id network connection ID assigned by TNCC
+ * @param state state for current connection
* @param msg received unparsed message
- * @param msg_type message type of the received message
+ * @param msg_vid message vendorID of the received message
+ * @param msg_subtype message subtype of the received message
+ * @param src_imv_id source IMV ID
+ * @param dst_imc_id destination IMC ID
* @param pa_tnc_message parsed PA-TNC message or NULL if an error occurred
* @return TNC result code
*/
TNC_Result (*receive_message)(imc_agent_t *this,
- TNC_ConnectionID connection_id, chunk_t msg,
- TNC_MessageType msg_type,
+ imc_state_t *state, chunk_t msg,
+ TNC_VendorID msg_vid,
+ TNC_MessageSubtype msg_subtype,
+ TNC_UInt32 src_imv_id,
+ TNC_UInt32 dst_imc_id,
pa_tnc_msg_t **pa_tnc_msg);
/**
}
METHOD(imv_agent_t, receive_message, TNC_Result,
- private_imv_agent_t *this, TNC_ConnectionID connection_id, chunk_t msg,
- TNC_MessageType msg_type, pa_tnc_msg_t **pa_tnc_msg)
+ private_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)
{
pa_tnc_msg_t *pa_msg, *error_msg;
pa_tnc_attr_t *error_attr;
enumerator_t *enumerator;
+ TNC_MessageType msg_type;
+ TNC_UInt32 msg_flags, src_imv_id, dst_imc_id;
+ TNC_ConnectionID connection_id;
TNC_Result result;
- DBG2(DBG_IMV, "IMV %u \"%s\" received message type 0x%08x for Connection ID %u",
- this->id, this->name, msg_type, connection_id);
+ connection_id = state->get_connection_id(state);
+
+ if (state->has_long(state))
+ {
+ if (dst_imv_id != TNC_IMVID_ANY)
+ {
+ DBG2(DBG_IMV, "IMV %u \"%s\" received message for Connection ID %u "
+ "from IMC %u to IMV %u", this->id, this->name,
+ connection_id, src_imc_id, dst_imv_id);
+ }
+ else
+ {
+ DBG2(DBG_IMV, "IMV %u \"%s\" received message for Connection ID %u "
+ "from IMC %u", this->id, this->name, connection_id,
+ src_imc_id);
+ }
+ }
+ else
+ {
+ DBG2(DBG_IMV, "IMV %u \"%s\" received message for Connection ID %u",
+ this->id, this->name, connection_id);
+ }
*pa_tnc_msg = NULL;
pa_msg = pa_tnc_msg_create_from_data(msg);
*pa_tnc_msg = pa_msg;
break;
case VERIFY_ERROR:
- if (!this->send_message)
- {
- /* TNCS doen't have a SendMessage() function */
- return TNC_RESULT_FATAL;
- }
-
/* build error message */
error_msg = pa_tnc_msg_create();
enumerator = pa_msg->create_error_enumerator(pa_msg);
/* send error message */
msg = error_msg->get_encoding(error_msg);
- result = this->send_message(this->id, connection_id,
+
+ if (state->has_long(state) && this->send_message_long)
+ {
+ if (state->has_excl(state))
+ {
+ msg_flags = TNC_MESSAGE_FLAGS_EXCLUSIVE;
+ dst_imc_id = src_imc_id;
+ }
+ else
+ {
+ msg_flags = 0;
+ dst_imc_id = TNC_IMCID_ANY;
+ }
+ src_imv_id = (dst_imv_id == TNC_IMVID_ANY) ? this->id
+ : dst_imv_id;
+
+ result = this->send_message_long(src_imv_id, connection_id,
+ msg_flags, msg.ptr, msg.len, msg_vid,
+ msg_subtype, dst_imc_id);
+ }
+ else if (this->send_message)
+ {
+ msg_type = (msg_vid << 8) | msg_subtype;
+
+ result = this->send_message(this->id, connection_id,
msg.ptr, msg.len, msg_type);
+ }
+ else
+ {
+ result = TNC_RESULT_FATAL;
+ }
/* clean up */
error_msg->destroy(error_msg);
case FAILED:
default:
pa_msg->destroy(pa_msg);
- return set_recommendation(this, connection_id,
+ state->set_recommendation(state,
+ TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
+ TNC_IMV_EVALUATION_RESULT_ERROR);
+ return this->provide_recommendation(this->id, connection_id,
TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
TNC_IMV_EVALUATION_RESULT_ERROR);
}
/**
* Call when a PA-TNC message was received
*
- * @param connection_id network connection ID assigned by TNCS
+ * @param state state for current connection
* @param msg received unparsed message
- * @param msg_type message type of the received 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,
- TNC_ConnectionID connection_id, chunk_t msg,
- TNC_MessageType msg_type,
+ 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);
/**
static imc_agent_t *imc_scanner;
/**
- * see section 3.7.1 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.1 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
TNC_Version min_version,
}
/**
- * see section 3.7.2 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.2 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
}
/**
- * see section 3.7.3 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
TNC_ConnectionID connection_id)
return send_message(connection_id);
}
-/**
- * see section 3.7.4 of TCG TNC IF-IMC Specification 1.2
- */
-TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
+static TNC_Result receive_message(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
- TNC_BufferReference msg,
- TNC_UInt32 msg_len,
- TNC_MessageType msg_type)
+ TNC_UInt32 msg_flags,
+ chunk_t msg,
+ TNC_VendorID msg_vid,
+ TNC_MessageSubtype msg_subtype,
+ TNC_UInt32 src_imv_id,
+ TNC_UInt32 dst_imc_id)
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
+ imc_state_t *state;
enumerator_t *enumerator;
TNC_Result result;
bool fatal_error = FALSE;
return TNC_RESULT_NOT_INITIALIZED;
}
+ /* get current IMC state */
+ if (!imc_scanner->get_state(imc_scanner, connection_id, &state))
+ {
+ return TNC_RESULT_FATAL;
+ }
+
/* parse received PA-TNC message and automatically handle any errors */
- result = imc_scanner->receive_message(imc_scanner, connection_id,
- chunk_create(msg, msg_len), msg_type,
- &pa_tnc_msg);
+ result = imc_scanner->receive_message(imc_scanner, state, msg, msg_vid,
+ msg_subtype, src_imv_id, dst_imc_id, &pa_tnc_msg);
/* no parsed PA-TNC attributes available if an error occurred */
if (!pa_tnc_msg)
}
/**
- * see section 3.7.5 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.4 of TCG TNC IF-IMC Specification 1.3
+ */
+TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
+ TNC_ConnectionID connection_id,
+ TNC_BufferReference msg,
+ TNC_UInt32 msg_len,
+ TNC_MessageType msg_type)
+{
+ TNC_VendorID msg_vid;
+ TNC_MessageSubtype msg_subtype;
+
+ msg_vid = msg_type >> 8;
+ msg_subtype = msg_type & TNC_SUBTYPE_ANY;
+
+ return receive_message(imc_id, connection_id, 0, chunk_create(msg, msg_len),
+ msg_vid, msg_subtype, 0, TNC_IMCID_ANY);
+}
+
+/**
+ * see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMC_ReceiveMessageLong(TNC_IMCID imc_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 src_imv_id,
+ TNC_UInt32 dst_imc_id)
+{
+ return receive_message(imc_id, connection_id, msg_flags,
+ chunk_create(msg, msg_len), msg_vid, msg_subtype,
+ src_imv_id, dst_imc_id);
+}
+
+/**
+ * see section 3.8.7 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_BatchEnding(TNC_IMCID imc_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.6 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.8 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
{
}
/**
- * see section 4.2.8.1 of TCG TNC IF-IMC Specification 1.2
+ * see section 4.2.8.1 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_ProvideBindFunction(TNC_IMCID imc_id,
TNC_TNCC_BindFunctionPointer bind_function)
static imc_agent_t *imc_test;
/**
- * see section 3.7.1 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.1 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
TNC_Version min_version,
}
/**
- * see section 3.7.2 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.2 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
}
/**
- * see section 3.7.3 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
TNC_ConnectionID connection_id)
return send_message(connection_id);
}
-/**
- * see section 3.7.4 of TCG TNC IF-IMC Specification 1.2
- */
-TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
+static TNC_Result receive_message(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
- TNC_BufferReference msg,
- TNC_UInt32 msg_len,
- TNC_MessageType msg_type)
+ TNC_UInt32 msg_flags,
+ chunk_t msg,
+ TNC_VendorID msg_vid,
+ TNC_MessageSubtype msg_subtype,
+ TNC_UInt32 src_imv_id,
+ TNC_UInt32 dst_imc_id)
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
+ imc_state_t *state;
enumerator_t *enumerator;
TNC_Result result;
bool fatal_error = FALSE;
return TNC_RESULT_NOT_INITIALIZED;
}
+ /* get current IMC state */
+ if (!imc_test->get_state(imc_test, connection_id, &state))
+ {
+ return TNC_RESULT_FATAL;
+ }
+
/* parse received PA-TNC message and automatically handle any errors */
- result = imc_test->receive_message(imc_test, connection_id,
- chunk_create(msg, msg_len), msg_type,
- &pa_tnc_msg);
+ result = imc_test->receive_message(imc_test, state, msg, msg_vid,
+ msg_subtype, src_imv_id, dst_imc_id, &pa_tnc_msg);
/* no parsed PA-TNC attributes available if an error occurred */
if (!pa_tnc_msg)
}
/**
- * see section 3.7.5 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.4 of TCG TNC IF-IMC Specification 1.3
+ */
+TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
+ TNC_ConnectionID connection_id,
+ TNC_BufferReference msg,
+ TNC_UInt32 msg_len,
+ TNC_MessageType msg_type)
+{
+ TNC_VendorID msg_vid;
+ TNC_MessageSubtype msg_subtype;
+
+ msg_vid = msg_type >> 8;
+ msg_subtype = msg_type & TNC_SUBTYPE_ANY;
+
+ return receive_message(imc_id, connection_id, 0, chunk_create(msg, msg_len),
+ msg_vid, msg_subtype, 0, TNC_IMCID_ANY);
+}
+
+/**
+ * see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMC_ReceiveMessageLong(TNC_IMCID imc_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 src_imv_id,
+ TNC_UInt32 dst_imc_id)
+{
+ return receive_message(imc_id, connection_id, msg_flags,
+ chunk_create(msg, msg_len), msg_vid, msg_subtype,
+ src_imv_id, dst_imc_id);
+}
+
+/**
+ * see section 3.8.7 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_BatchEnding(TNC_IMCID imc_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.6 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.8 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
{
}
/**
- * see section 4.2.8.1 of TCG TNC IF-IMC Specification 1.2
+ * see section 4.2.8.1 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_ProvideBindFunction(TNC_IMCID imc_id,
TNC_TNCC_BindFunctionPointer bind_function)
/*
- * see section 3.7.1 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.1 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
TNC_Version min_version,
}
/**
- * see section 3.7.2 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.2 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
}
}
-/**
- * see section 3.7.3 of TCG TNC IF-IMV Specification 1.2
- */
-TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
+static TNC_Result receive_message(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
- TNC_BufferReference msg,
- TNC_UInt32 msg_len,
- TNC_MessageType msg_type)
+ TNC_UInt32 msg_flags,
+ 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;
pa_tnc_attr_t *attr;
}
/* parse received PA-TNC message and automatically handle any errors */
- result = imv_scanner->receive_message(imv_scanner, connection_id,
- chunk_create(msg, msg_len), msg_type,
- &pa_tnc_msg);
+ result = imv_scanner->receive_message(imv_scanner, state, msg, msg_vid,
+ msg_subtype, src_imc_id, dst_imv_id, &pa_tnc_msg);
/* no parsed PA-TNC attributes available if an error occurred */
if (!pa_tnc_msg)
}
return imv_scanner->provide_recommendation(imv_scanner, connection_id);
+ }
+
+/**
+ * see section 3.8.4 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
+ TNC_ConnectionID connection_id,
+ TNC_BufferReference msg,
+ TNC_UInt32 msg_len,
+ TNC_MessageType msg_type)
+{
+ TNC_VendorID msg_vid;
+ TNC_MessageSubtype msg_subtype;
+
+ msg_vid = msg_type >> 8;
+ msg_subtype = msg_type & TNC_SUBTYPE_ANY;
+
+ return receive_message(imv_id, connection_id, 0, chunk_create(msg, msg_len),
+ msg_vid, msg_subtype, 0, TNC_IMVID_ANY);
+}
+
+/**
+ * see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMV_ReceiveMessageLong(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 src_imc_id,
+ TNC_UInt32 dst_imv_id)
+{
+ return receive_message(imv_id, connection_id, msg_flags,
+ chunk_create(msg, msg_len), msg_vid, msg_subtype,
+ src_imc_id, dst_imv_id);
}
/**
- * see section 3.7.4 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.7 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.5 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.8 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.6 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.9 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
{
}
/**
- * see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.2
+ * see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_ProvideBindFunction(TNC_IMVID imv_id,
TNC_TNCS_BindFunctionPointer bind_function)
static imv_agent_t *imv_test;
/**
- * see section 3.7.1 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.1 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
TNC_Version min_version,
}
/**
- * see section 3.7.2 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.2 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
return result;
}
-/**
- * see section 3.7.3 of TCG TNC IF-IMV Specification 1.2
- */
-TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
+static TNC_Result receive_message(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
- TNC_BufferReference msg,
- TNC_UInt32 msg_len,
- TNC_MessageType msg_type)
+ TNC_UInt32 msg_flags,
+ 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;
pa_tnc_attr_t *attr;
}
/* parse received PA-TNC message and automatically handle any errors */
- result = imv_test->receive_message(imv_test, connection_id,
- chunk_create(msg, msg_len), msg_type,
- &pa_tnc_msg);
+ result = imv_test->receive_message(imv_test, state, msg, msg_vid,
+ msg_subtype, src_imc_id, dst_imv_id, &pa_tnc_msg);
/* no parsed PA-TNC attributes available if an error occurred */
if (!pa_tnc_msg)
}
/**
- * see section 3.7.4 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.4 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
+ TNC_ConnectionID connection_id,
+ TNC_BufferReference msg,
+ TNC_UInt32 msg_len,
+ TNC_MessageType msg_type)
+{
+ TNC_VendorID msg_vid;
+ TNC_MessageSubtype msg_subtype;
+
+ msg_vid = msg_type >> 8;
+ msg_subtype = msg_type & TNC_SUBTYPE_ANY;
+
+ return receive_message(imv_id, connection_id, 0, chunk_create(msg, msg_len),
+ msg_vid, msg_subtype, 0, TNC_IMVID_ANY);
+}
+
+/**
+ * see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMV_ReceiveMessageLong(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 src_imc_id,
+ TNC_UInt32 dst_imv_id)
+{
+ return receive_message(imv_id, connection_id, msg_flags,
+ chunk_create(msg, msg_len), msg_vid, msg_subtype,
+ src_imc_id, dst_imv_id);
+}
+
+/**
+ * see section 3.8.7 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.5 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.8 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.6 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.9 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
{
}
/**
- * see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.2
+ * see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_ProvideBindFunction(TNC_IMVID imv_id,
TNC_TNCS_BindFunctionPointer bind_function)
static pts_dh_group_t supported_dh_groups = PTS_DH_GROUP_NONE;
/**
- * see section 3.7.1 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.1 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
TNC_Version min_version,
}
/**
- * see section 3.7.2 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.2 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
/**
- * see section 3.7.3 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
TNC_ConnectionID connection_id)
return result;
}
-/**
- * see section 3.7.4 of TCG TNC IF-IMC Specification 1.2
- */
-TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
+static TNC_Result receive_message(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
- TNC_BufferReference msg,
- TNC_UInt32 msg_len,
- TNC_MessageType msg_type)
+ TNC_UInt32 msg_flags,
+ chunk_t msg,
+ TNC_VendorID msg_vid,
+ TNC_MessageSubtype msg_subtype,
+ TNC_UInt32 src_imv_id,
+ TNC_UInt32 dst_imc_id)
{
pa_tnc_msg_t *pa_tnc_msg;
pa_tnc_attr_t *attr;
attestation_state = (imc_attestation_state_t*)state;
/* parse received PA-TNC message and automatically handle any errors */
- result = imc_attestation->receive_message(imc_attestation, connection_id,
- chunk_create(msg, msg_len), msg_type,
- &pa_tnc_msg);
+ result = imc_attestation->receive_message(imc_attestation, state, msg,
+ msg_vid, msg_subtype, src_imv_id, dst_imc_id, &pa_tnc_msg);
/* no parsed PA-TNC attributes available if an error occurred */
if (!pa_tnc_msg)
}
/**
- * see section 3.7.5 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.4 of TCG TNC IF-IMC Specification 1.3
+ */
+TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
+ TNC_ConnectionID connection_id,
+ TNC_BufferReference msg,
+ TNC_UInt32 msg_len,
+ TNC_MessageType msg_type)
+{
+ TNC_VendorID msg_vid;
+ TNC_MessageSubtype msg_subtype;
+
+ msg_vid = msg_type >> 8;
+ msg_subtype = msg_type & TNC_SUBTYPE_ANY;
+
+ return receive_message(imc_id, connection_id, 0, chunk_create(msg, msg_len),
+ msg_vid, msg_subtype, 0, TNC_IMCID_ANY);
+}
+
+/**
+ * see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMC_ReceiveMessageLong(TNC_IMCID imc_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 src_imv_id,
+ TNC_UInt32 dst_imc_id)
+{
+ return receive_message(imc_id, connection_id, msg_flags,
+ chunk_create(msg, msg_len), msg_vid, msg_subtype,
+ src_imv_id, dst_imc_id);
+}
+
+/**
+ * see section 3.8.7 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_BatchEnding(TNC_IMCID imc_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.6 of TCG TNC IF-IMC Specification 1.2
+ * see section 3.8.8 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
{
}
/**
- * see section 4.2.8.1 of TCG TNC IF-IMC Specification 1.2
+ * see section 4.2.8.1 of TCG TNC IF-IMC Specification 1.3
*/
TNC_Result TNC_IMC_ProvideBindFunction(TNC_IMCID imc_id,
TNC_TNCC_BindFunctionPointer bind_function)
static credential_manager_t *pts_credmgr;
/**
- * see section 3.7.1 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.1 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
TNC_Version min_version,
}
/**
- * see section 3.7.2 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.2 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
return result;
}
-/**
- * see section 3.7.3 of TCG TNC IF-IMV Specification 1.2
- */
-TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
+static TNC_Result receive_message(TNC_IMVID imv_id,
TNC_ConnectionID connection_id,
- TNC_BufferReference msg,
- TNC_UInt32 msg_len,
- TNC_MessageType msg_type)
+ TNC_UInt32 msg_flags,
+ 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;
pa_tnc_attr_t *attr;
pts = attestation_state->get_pts(attestation_state);
/* parse received PA-TNC message and automatically handle any errors */
- result = imv_attestation->receive_message(imv_attestation, connection_id,
- chunk_create(msg, msg_len), msg_type,
- &pa_tnc_msg);
+ result = imv_attestation->receive_message(imv_attestation, state, msg,
+ msg_vid, msg_subtype, src_imc_id, dst_imv_id, &pa_tnc_msg);
/* no parsed PA-TNC attributes available if an error occurred */
if (!pa_tnc_msg)
}
/**
- * see section 3.7.4 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.4 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
+ TNC_ConnectionID connection_id,
+ TNC_BufferReference msg,
+ TNC_UInt32 msg_len,
+ TNC_MessageType msg_type)
+{
+ TNC_VendorID msg_vid;
+ TNC_MessageSubtype msg_subtype;
+
+ msg_vid = msg_type >> 8;
+ msg_subtype = msg_type & TNC_SUBTYPE_ANY;
+
+ return receive_message(imv_id, connection_id, 0, chunk_create(msg, msg_len),
+ msg_vid, msg_subtype, 0, TNC_IMVID_ANY);
+}
+
+/**
+ * see section 3.8.6 of TCG TNC IF-IMV Specification 1.3
+ */
+TNC_Result TNC_IMV_ReceiveMessageLong(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 src_imc_id,
+ TNC_UInt32 dst_imv_id)
+{
+ return receive_message(imv_id, connection_id, msg_flags,
+ chunk_create(msg, msg_len), msg_vid, msg_subtype,
+ src_imc_id, dst_imv_id);
+}
+
+/**
+ * see section 3.8.7 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.5 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.8 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
TNC_ConnectionID connection_id)
}
/**
- * see section 3.7.6 of TCG TNC IF-IMV Specification 1.2
+ * see section 3.8.9 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
{
}
/**
- * see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.2
+ * see section 4.2.8.1 of TCG TNC IF-IMV Specification 1.3
*/
TNC_Result TNC_IMV_ProvideBindFunction(TNC_IMVID imv_id,
TNC_TNCS_BindFunctionPointer bind_function)