implemented IMC/IMV ReceiveMessageLong functions
This commit is contained in:
@@ -369,6 +369,8 @@ imv_t* tnc_imv_create(char *name, char *path)
|
|||||||
}
|
}
|
||||||
this->public.receive_message =
|
this->public.receive_message =
|
||||||
dlsym(this->handle, "TNC_IMV_ReceiveMessage");
|
dlsym(this->handle, "TNC_IMV_ReceiveMessage");
|
||||||
|
this->public.receive_message_long =
|
||||||
|
dlsym(this->handle, "TNC_IMV_ReceiveMessageLong");
|
||||||
this->public.batch_ending =
|
this->public.batch_ending =
|
||||||
dlsym(this->handle, "TNC_IMV_BatchEnding");
|
dlsym(this->handle, "TNC_IMV_BatchEnding");
|
||||||
this->public.terminate =
|
this->public.terminate =
|
||||||
|
|||||||
+57
-12
@@ -485,16 +485,40 @@ METHOD(imc_agent_t, send_message, TNC_Result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
METHOD(imc_agent_t, receive_message, TNC_Result,
|
METHOD(imc_agent_t, receive_message, TNC_Result,
|
||||||
private_imc_agent_t *this, TNC_ConnectionID connection_id, chunk_t msg,
|
private_imc_agent_t *this, imc_state_t *state, chunk_t msg,
|
||||||
TNC_MessageType msg_type, pa_tnc_msg_t **pa_tnc_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_msg_t *pa_msg, *error_msg;
|
||||||
pa_tnc_attr_t *error_attr;
|
pa_tnc_attr_t *error_attr;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
TNC_MessageType msg_type;
|
||||||
|
TNC_UInt32 msg_flags, src_imc_id, dst_imv_id;
|
||||||
|
TNC_ConnectionID connection_id;
|
||||||
TNC_Result result;
|
TNC_Result result;
|
||||||
|
|
||||||
DBG2(DBG_IMV, "IMC %u \"%s\" received message type 0x%08x for Connection ID %u",
|
connection_id = state->get_connection_id(state);
|
||||||
this->id, this->name, msg_type, connection_id);
|
|
||||||
|
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_tnc_msg = NULL;
|
||||||
pa_msg = pa_tnc_msg_create_from_data(msg);
|
pa_msg = pa_tnc_msg_create_from_data(msg);
|
||||||
@@ -505,12 +529,6 @@ METHOD(imc_agent_t, receive_message, TNC_Result,
|
|||||||
*pa_tnc_msg = pa_msg;
|
*pa_tnc_msg = pa_msg;
|
||||||
break;
|
break;
|
||||||
case VERIFY_ERROR:
|
case VERIFY_ERROR:
|
||||||
if (!this->send_message)
|
|
||||||
{
|
|
||||||
/* TNCC doen't have a SendMessage() function */
|
|
||||||
return TNC_RESULT_FATAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* build error message */
|
/* build error message */
|
||||||
error_msg = pa_tnc_msg_create();
|
error_msg = pa_tnc_msg_create();
|
||||||
enumerator = pa_msg->create_error_enumerator(pa_msg);
|
enumerator = pa_msg->create_error_enumerator(pa_msg);
|
||||||
@@ -523,9 +541,36 @@ METHOD(imc_agent_t, receive_message, TNC_Result,
|
|||||||
error_msg->build(error_msg);
|
error_msg->build(error_msg);
|
||||||
|
|
||||||
/* send error message */
|
/* send error message */
|
||||||
msg = error_msg->get_encoding(error_msg);
|
if (state->has_long(state) && this->send_message_long)
|
||||||
result = this->send_message(this->id, connection_id,
|
{
|
||||||
|
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);
|
msg.ptr, msg.len, msg_type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = TNC_RESULT_FATAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
error_msg->destroy(error_msg);
|
error_msg->destroy(error_msg);
|
||||||
|
|||||||
@@ -115,15 +115,21 @@ struct imc_agent_t {
|
|||||||
/**
|
/**
|
||||||
* Call when a PA-TNC message was received
|
* 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 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
|
* @param pa_tnc_message parsed PA-TNC message or NULL if an error occurred
|
||||||
* @return TNC result code
|
* @return TNC result code
|
||||||
*/
|
*/
|
||||||
TNC_Result (*receive_message)(imc_agent_t *this,
|
TNC_Result (*receive_message)(imc_agent_t *this,
|
||||||
TNC_ConnectionID connection_id, chunk_t msg,
|
imc_state_t *state, chunk_t msg,
|
||||||
TNC_MessageType msg_type,
|
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_tnc_msg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+62
-12
@@ -521,16 +521,40 @@ METHOD(imv_agent_t, set_recommendation, TNC_Result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
METHOD(imv_agent_t, receive_message, TNC_Result,
|
METHOD(imv_agent_t, receive_message, TNC_Result,
|
||||||
private_imv_agent_t *this, TNC_ConnectionID connection_id, chunk_t msg,
|
private_imv_agent_t *this, imv_state_t *state, chunk_t msg,
|
||||||
TNC_MessageType msg_type, pa_tnc_msg_t **pa_tnc_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_msg_t *pa_msg, *error_msg;
|
||||||
pa_tnc_attr_t *error_attr;
|
pa_tnc_attr_t *error_attr;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
TNC_MessageType msg_type;
|
||||||
|
TNC_UInt32 msg_flags, src_imv_id, dst_imc_id;
|
||||||
|
TNC_ConnectionID connection_id;
|
||||||
TNC_Result result;
|
TNC_Result result;
|
||||||
|
|
||||||
DBG2(DBG_IMV, "IMV %u \"%s\" received message type 0x%08x for Connection ID %u",
|
connection_id = state->get_connection_id(state);
|
||||||
this->id, this->name, msg_type, connection_id);
|
|
||||||
|
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_tnc_msg = NULL;
|
||||||
pa_msg = pa_tnc_msg_create_from_data(msg);
|
pa_msg = pa_tnc_msg_create_from_data(msg);
|
||||||
@@ -541,12 +565,6 @@ METHOD(imv_agent_t, receive_message, TNC_Result,
|
|||||||
*pa_tnc_msg = pa_msg;
|
*pa_tnc_msg = pa_msg;
|
||||||
break;
|
break;
|
||||||
case VERIFY_ERROR:
|
case VERIFY_ERROR:
|
||||||
if (!this->send_message)
|
|
||||||
{
|
|
||||||
/* TNCS doen't have a SendMessage() function */
|
|
||||||
return TNC_RESULT_FATAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* build error message */
|
/* build error message */
|
||||||
error_msg = pa_tnc_msg_create();
|
error_msg = pa_tnc_msg_create();
|
||||||
enumerator = pa_msg->create_error_enumerator(pa_msg);
|
enumerator = pa_msg->create_error_enumerator(pa_msg);
|
||||||
@@ -560,8 +578,37 @@ METHOD(imv_agent_t, receive_message, TNC_Result,
|
|||||||
|
|
||||||
/* send error message */
|
/* send error message */
|
||||||
msg = error_msg->get_encoding(error_msg);
|
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);
|
msg.ptr, msg.len, msg_type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = TNC_RESULT_FATAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
error_msg->destroy(error_msg);
|
error_msg->destroy(error_msg);
|
||||||
@@ -570,7 +617,10 @@ METHOD(imv_agent_t, receive_message, TNC_Result,
|
|||||||
case FAILED:
|
case FAILED:
|
||||||
default:
|
default:
|
||||||
pa_msg->destroy(pa_msg);
|
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_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
|
||||||
TNC_IMV_EVALUATION_RESULT_ERROR);
|
TNC_IMV_EVALUATION_RESULT_ERROR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,15 +115,21 @@ struct imv_agent_t {
|
|||||||
/**
|
/**
|
||||||
* Call when a PA-TNC message was received
|
* 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 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
|
* @param pa_tnc_message parsed PA-TNC message or NULL if an error occurred
|
||||||
* @return TNC result code
|
* @return TNC result code
|
||||||
*/
|
*/
|
||||||
TNC_Result (*receive_message)(imv_agent_t *this,
|
TNC_Result (*receive_message)(imv_agent_t *this,
|
||||||
TNC_ConnectionID connection_id, chunk_t msg,
|
imv_state_t *state, chunk_t msg,
|
||||||
TNC_MessageType msg_type,
|
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_tnc_msg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ static const char imc_name[] = "Scanner";
|
|||||||
static imc_agent_t *imc_scanner;
|
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_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
|
||||||
TNC_Version min_version,
|
TNC_Version min_version,
|
||||||
@@ -66,7 +66,7 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
@@ -245,7 +245,7 @@ static TNC_Result send_message(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_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -258,17 +258,18 @@ TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
|||||||
return send_message(connection_id);
|
return send_message(connection_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static TNC_Result receive_message(TNC_IMCID imc_id,
|
||||||
* see section 3.7.4 of TCG TNC IF-IMC Specification 1.2
|
|
||||||
*/
|
|
||||||
TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
TNC_BufferReference msg,
|
TNC_UInt32 msg_flags,
|
||||||
TNC_UInt32 msg_len,
|
chunk_t msg,
|
||||||
TNC_MessageType msg_type)
|
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_tnc_msg;
|
||||||
pa_tnc_attr_t *attr;
|
pa_tnc_attr_t *attr;
|
||||||
|
imc_state_t *state;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
TNC_Result result;
|
TNC_Result result;
|
||||||
bool fatal_error = FALSE;
|
bool fatal_error = FALSE;
|
||||||
@@ -279,10 +280,15 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|||||||
return TNC_RESULT_NOT_INITIALIZED;
|
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 */
|
/* parse received PA-TNC message and automatically handle any errors */
|
||||||
result = imc_scanner->receive_message(imc_scanner, connection_id,
|
result = imc_scanner->receive_message(imc_scanner, state, msg, msg_vid,
|
||||||
chunk_create(msg, msg_len), msg_type,
|
msg_subtype, src_imv_id, dst_imc_id, &pa_tnc_msg);
|
||||||
&pa_tnc_msg);
|
|
||||||
|
|
||||||
/* no parsed PA-TNC attributes available if an error occurred */
|
/* no parsed PA-TNC attributes available if an error occurred */
|
||||||
if (!pa_tnc_msg)
|
if (!pa_tnc_msg)
|
||||||
@@ -334,7 +340,44 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMC_BatchEnding(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -348,7 +391,7 @@ TNC_Result TNC_IMC_BatchEnding(TNC_IMCID imc_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)
|
TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
|
||||||
{
|
{
|
||||||
@@ -364,7 +407,7 @@ 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_Result TNC_IMC_ProvideBindFunction(TNC_IMCID imc_id,
|
||||||
TNC_TNCC_BindFunctionPointer bind_function)
|
TNC_TNCC_BindFunctionPointer bind_function)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ static const char imc_name[] = "Test";
|
|||||||
static imc_agent_t *imc_test;
|
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_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
|
||||||
TNC_Version min_version,
|
TNC_Version min_version,
|
||||||
@@ -64,7 +64,7 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
@@ -228,7 +228,7 @@ static TNC_Result send_message(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_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -241,17 +241,18 @@ TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
|||||||
return send_message(connection_id);
|
return send_message(connection_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static TNC_Result receive_message(TNC_IMCID imc_id,
|
||||||
* see section 3.7.4 of TCG TNC IF-IMC Specification 1.2
|
|
||||||
*/
|
|
||||||
TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
TNC_BufferReference msg,
|
TNC_UInt32 msg_flags,
|
||||||
TNC_UInt32 msg_len,
|
chunk_t msg,
|
||||||
TNC_MessageType msg_type)
|
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_tnc_msg;
|
||||||
pa_tnc_attr_t *attr;
|
pa_tnc_attr_t *attr;
|
||||||
|
imc_state_t *state;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
TNC_Result result;
|
TNC_Result result;
|
||||||
bool fatal_error = FALSE;
|
bool fatal_error = FALSE;
|
||||||
@@ -262,10 +263,15 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|||||||
return TNC_RESULT_NOT_INITIALIZED;
|
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 */
|
/* parse received PA-TNC message and automatically handle any errors */
|
||||||
result = imc_test->receive_message(imc_test, connection_id,
|
result = imc_test->receive_message(imc_test, state, msg, msg_vid,
|
||||||
chunk_create(msg, msg_len), msg_type,
|
msg_subtype, src_imv_id, dst_imc_id, &pa_tnc_msg);
|
||||||
&pa_tnc_msg);
|
|
||||||
|
|
||||||
/* no parsed PA-TNC attributes available if an error occurred */
|
/* no parsed PA-TNC attributes available if an error occurred */
|
||||||
if (!pa_tnc_msg)
|
if (!pa_tnc_msg)
|
||||||
@@ -324,7 +330,44 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMC_BatchEnding(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -338,7 +381,7 @@ TNC_Result TNC_IMC_BatchEnding(TNC_IMCID imc_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)
|
TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
|
||||||
{
|
{
|
||||||
@@ -354,7 +397,7 @@ 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_Result TNC_IMC_ProvideBindFunction(TNC_IMCID imc_id,
|
||||||
TNC_TNCC_BindFunctionPointer bind_function)
|
TNC_TNCC_BindFunctionPointer bind_function)
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ static linked_list_t* get_port_list(char *label)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
|
||||||
TNC_Version min_version,
|
TNC_Version min_version,
|
||||||
@@ -149,7 +149,7 @@ TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
@@ -175,14 +175,14 @@ TNC_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static TNC_Result receive_message(TNC_IMVID imv_id,
|
||||||
* see section 3.7.3 of TCG TNC IF-IMV Specification 1.2
|
|
||||||
*/
|
|
||||||
TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
TNC_BufferReference msg,
|
TNC_UInt32 msg_flags,
|
||||||
TNC_UInt32 msg_len,
|
chunk_t msg,
|
||||||
TNC_MessageType msg_type)
|
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_tnc_msg;
|
||||||
pa_tnc_attr_t *attr;
|
pa_tnc_attr_t *attr;
|
||||||
@@ -204,9 +204,8 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* parse received PA-TNC message and automatically handle any errors */
|
/* parse received PA-TNC message and automatically handle any errors */
|
||||||
result = imv_scanner->receive_message(imv_scanner, connection_id,
|
result = imv_scanner->receive_message(imv_scanner, state, msg, msg_vid,
|
||||||
chunk_create(msg, msg_len), msg_type,
|
msg_subtype, src_imc_id, dst_imv_id, &pa_tnc_msg);
|
||||||
&pa_tnc_msg);
|
|
||||||
|
|
||||||
/* no parsed PA-TNC attributes available if an error occurred */
|
/* no parsed PA-TNC attributes available if an error occurred */
|
||||||
if (!pa_tnc_msg)
|
if (!pa_tnc_msg)
|
||||||
@@ -339,10 +338,47 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return imv_scanner->provide_recommendation(imv_scanner, connection_id);
|
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.7.4 of TCG TNC IF-IMV Specification 1.2
|
* 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_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -356,7 +392,7 @@ TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_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_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -370,7 +406,7 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_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)
|
TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
|
||||||
{
|
{
|
||||||
@@ -388,7 +424,7 @@ 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_Result TNC_IMV_ProvideBindFunction(TNC_IMVID imv_id,
|
||||||
TNC_TNCS_BindFunctionPointer bind_function)
|
TNC_TNCS_BindFunctionPointer bind_function)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ static const char imv_name[] = "Test";
|
|||||||
static imv_agent_t *imv_test;
|
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_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
|
||||||
TNC_Version min_version,
|
TNC_Version min_version,
|
||||||
@@ -64,7 +64,7 @@ TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
@@ -125,14 +125,14 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static TNC_Result receive_message(TNC_IMVID imv_id,
|
||||||
* see section 3.7.3 of TCG TNC IF-IMV Specification 1.2
|
|
||||||
*/
|
|
||||||
TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
TNC_BufferReference msg,
|
TNC_UInt32 msg_flags,
|
||||||
TNC_UInt32 msg_len,
|
chunk_t msg,
|
||||||
TNC_MessageType msg_type)
|
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_tnc_msg;
|
||||||
pa_tnc_attr_t *attr;
|
pa_tnc_attr_t *attr;
|
||||||
@@ -155,9 +155,8 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* parse received PA-TNC message and automatically handle any errors */
|
/* parse received PA-TNC message and automatically handle any errors */
|
||||||
result = imv_test->receive_message(imv_test, connection_id,
|
result = imv_test->receive_message(imv_test, state, msg, msg_vid,
|
||||||
chunk_create(msg, msg_len), msg_type,
|
msg_subtype, src_imc_id, dst_imv_id, &pa_tnc_msg);
|
||||||
&pa_tnc_msg);
|
|
||||||
|
|
||||||
/* no parsed PA-TNC attributes available if an error occurred */
|
/* no parsed PA-TNC attributes available if an error occurred */
|
||||||
if (!pa_tnc_msg)
|
if (!pa_tnc_msg)
|
||||||
@@ -267,7 +266,44 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -281,7 +317,7 @@ TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_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_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -295,7 +331,7 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_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)
|
TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
|
||||||
{
|
{
|
||||||
@@ -311,7 +347,7 @@ 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_Result TNC_IMV_ProvideBindFunction(TNC_IMVID imv_id,
|
||||||
TNC_TNCS_BindFunctionPointer bind_function)
|
TNC_TNCS_BindFunctionPointer bind_function)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ static pts_meas_algorithms_t supported_algorithms = PTS_MEAS_ALGO_NONE;
|
|||||||
static pts_dh_group_t supported_dh_groups = PTS_DH_GROUP_NONE;
|
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_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
|
||||||
TNC_Version min_version,
|
TNC_Version min_version,
|
||||||
@@ -90,7 +90,7 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
@@ -121,7 +121,7 @@ TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_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_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -165,14 +165,14 @@ TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static TNC_Result receive_message(TNC_IMCID imc_id,
|
||||||
* see section 3.7.4 of TCG TNC IF-IMC Specification 1.2
|
|
||||||
*/
|
|
||||||
TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
TNC_BufferReference msg,
|
TNC_UInt32 msg_flags,
|
||||||
TNC_UInt32 msg_len,
|
chunk_t msg,
|
||||||
TNC_MessageType msg_type)
|
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_tnc_msg;
|
||||||
pa_tnc_attr_t *attr;
|
pa_tnc_attr_t *attr;
|
||||||
@@ -196,9 +196,8 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|||||||
attestation_state = (imc_attestation_state_t*)state;
|
attestation_state = (imc_attestation_state_t*)state;
|
||||||
|
|
||||||
/* parse received PA-TNC message and automatically handle any errors */
|
/* parse received PA-TNC message and automatically handle any errors */
|
||||||
result = imc_attestation->receive_message(imc_attestation, connection_id,
|
result = imc_attestation->receive_message(imc_attestation, state, msg,
|
||||||
chunk_create(msg, msg_len), msg_type,
|
msg_vid, msg_subtype, src_imv_id, dst_imc_id, &pa_tnc_msg);
|
||||||
&pa_tnc_msg);
|
|
||||||
|
|
||||||
/* no parsed PA-TNC attributes available if an error occurred */
|
/* no parsed PA-TNC attributes available if an error occurred */
|
||||||
if (!pa_tnc_msg)
|
if (!pa_tnc_msg)
|
||||||
@@ -278,7 +277,44 @@ TNC_Result TNC_IMC_ReceiveMessage(TNC_IMCID imc_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMC_BatchEnding(TNC_IMCID imc_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -292,7 +328,7 @@ TNC_Result TNC_IMC_BatchEnding(TNC_IMCID imc_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)
|
TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
|
||||||
{
|
{
|
||||||
@@ -311,7 +347,7 @@ 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_Result TNC_IMC_ProvideBindFunction(TNC_IMCID imc_id,
|
||||||
TNC_TNCC_BindFunctionPointer bind_function)
|
TNC_TNCC_BindFunctionPointer bind_function)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ static pts_creds_t *pts_creds;
|
|||||||
static credential_manager_t *pts_credmgr;
|
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_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
|
||||||
TNC_Version min_version,
|
TNC_Version min_version,
|
||||||
@@ -139,7 +139,7 @@ TNC_Result TNC_IMV_Initialize(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMV_NotifyConnectionChange(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
@@ -197,14 +197,14 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static TNC_Result receive_message(TNC_IMVID imv_id,
|
||||||
* see section 3.7.3 of TCG TNC IF-IMV Specification 1.2
|
|
||||||
*/
|
|
||||||
TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|
||||||
TNC_ConnectionID connection_id,
|
TNC_ConnectionID connection_id,
|
||||||
TNC_BufferReference msg,
|
TNC_UInt32 msg_flags,
|
||||||
TNC_UInt32 msg_len,
|
chunk_t msg,
|
||||||
TNC_MessageType msg_type)
|
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_tnc_msg;
|
||||||
pa_tnc_attr_t *attr;
|
pa_tnc_attr_t *attr;
|
||||||
@@ -230,9 +230,8 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|||||||
pts = attestation_state->get_pts(attestation_state);
|
pts = attestation_state->get_pts(attestation_state);
|
||||||
|
|
||||||
/* parse received PA-TNC message and automatically handle any errors */
|
/* parse received PA-TNC message and automatically handle any errors */
|
||||||
result = imv_attestation->receive_message(imv_attestation, connection_id,
|
result = imv_attestation->receive_message(imv_attestation, state, msg,
|
||||||
chunk_create(msg, msg_len), msg_type,
|
msg_vid, msg_subtype, src_imc_id, dst_imv_id, &pa_tnc_msg);
|
||||||
&pa_tnc_msg);
|
|
||||||
|
|
||||||
/* no parsed PA-TNC attributes available if an error occurred */
|
/* no parsed PA-TNC attributes available if an error occurred */
|
||||||
if (!pa_tnc_msg)
|
if (!pa_tnc_msg)
|
||||||
@@ -383,7 +382,44 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -398,7 +434,7 @@ TNC_Result TNC_IMV_SolicitRecommendation(TNC_IMVID imv_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_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
|
||||||
TNC_ConnectionID connection_id)
|
TNC_ConnectionID connection_id)
|
||||||
@@ -428,7 +464,7 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_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)
|
TNC_Result TNC_IMV_Terminate(TNC_IMVID imv_id)
|
||||||
{
|
{
|
||||||
@@ -454,7 +490,7 @@ 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_Result TNC_IMV_ProvideBindFunction(TNC_IMVID imv_id,
|
||||||
TNC_TNCS_BindFunctionPointer bind_function)
|
TNC_TNCS_BindFunctionPointer bind_function)
|
||||||
|
|||||||
Reference in New Issue
Block a user