Request missing SWID tags in a directed PA-TNC message

This commit is contained in:
Andreas Steffen 2016-03-04 01:04:44 +01:00
parent 88ce12a927
commit f00f679af9
3 changed files with 47 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2015 Andreas Steffen * Copyright (C) 2013-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -213,7 +213,8 @@ static TNC_Result receive_msg(private_imv_swid_agent_t *this,
if (request_id == swid_state->get_request_id(swid_state)) if (request_id == swid_state->get_request_id(swid_state))
{ {
swid_state->set_swid_inventory(swid_state, inventory); swid_state->set_swid_inventory(swid_state, inventory);
swid_state->set_count(swid_state, tag_id_count, 0); swid_state->set_count(swid_state, tag_id_count, 0,
in_msg->get_src_id(in_msg));
} }
else else
{ {
@ -251,7 +252,8 @@ static TNC_Result receive_msg(private_imv_swid_agent_t *this,
if (request_id == swid_state->get_request_id(swid_state)) if (request_id == swid_state->get_request_id(swid_state))
{ {
swid_state->set_count(swid_state, 0, tag_count); swid_state->set_count(swid_state, 0, tag_count,
in_msg->get_src_id(in_msg));
if (this->rest_api) if (this->rest_api)
{ {
@ -387,7 +389,8 @@ METHOD(imv_agent_if_t, batch_ending, TNC_Result,
} }
/* Create an empty out message - we might need it */ /* Create an empty out message - we might need it */
out_msg = imv_msg_create(this->agent, state, id, imv_id, TNC_IMCID_ANY, out_msg = imv_msg_create(this->agent, state, id, imv_id,
swid_state->get_imc_id(swid_state),
msg_types[0]); msg_types[0]);
if (!imcv_db) if (!imcv_db)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2014 Andreas Steffen * Copyright (C) 2013-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -122,6 +122,11 @@ struct private_imv_swid_state_t {
*/ */
uint32_t missing; uint32_t missing;
/**
* SWID IMC ID
*/
TNC_UInt32 imc_id;
/** /**
* Top level JSON object * Top level JSON object
*/ */
@ -326,10 +331,12 @@ METHOD(imv_swid_state_t, get_missing, uint32_t,
} }
METHOD(imv_swid_state_t, set_count, void, METHOD(imv_swid_state_t, set_count, void,
private_imv_swid_state_t *this, int tag_id_count, int tag_count) private_imv_swid_state_t *this, int tag_id_count, int tag_count,
TNC_UInt32 imc_id)
{ {
this->tag_id_count += tag_id_count; this->tag_id_count += tag_id_count;
this->tag_count += tag_count; this->tag_count += tag_count;
this->imc_id = imc_id;
} }
METHOD(imv_swid_state_t, get_count, void, METHOD(imv_swid_state_t, get_count, void,
@ -345,6 +352,12 @@ METHOD(imv_swid_state_t, get_count, void,
} }
} }
METHOD(imv_swid_state_t, get_imc_id, TNC_UInt32,
private_imv_swid_state_t *this)
{
return this->imc_id;
}
/** /**
* Described in header. * Described in header.
*/ */
@ -384,12 +397,14 @@ imv_state_t *imv_swid_state_create(TNC_ConnectionID connection_id)
.get_missing = _get_missing, .get_missing = _get_missing,
.set_count = _set_count, .set_count = _set_count,
.get_count = _get_count, .get_count = _get_count,
.get_imc_id = _get_imc_id,
}, },
.state = TNC_CONNECTION_STATE_CREATE, .state = TNC_CONNECTION_STATE_CREATE,
.rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION, .rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
.eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW, .eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW,
.connection_id = connection_id, .connection_id = connection_id,
.contracts = seg_contract_manager_create(), .contracts = seg_contract_manager_create(),
.imc_id = TNC_IMCID_ANY,
.jobj = json_object_new_object(), .jobj = json_object_new_object(),
.jarray = json_object_new_array(), .jarray = json_object_new_array(),
); );

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2014 Andreas Steffen * Copyright (C) 2013-2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil * HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -114,8 +114,10 @@ struct imv_swid_state_t {
* *
* @param tag_id_count Number of received SWID Tag IDs * @param tag_id_count Number of received SWID Tag IDs
* @param tag_count Number of received SWID Tags * @param tag_count Number of received SWID Tags
* @param imc_id SWID IMC ID
*/ */
void (*set_count)(imv_swid_state_t *this, int tag_id_count, int tag_count); void (*set_count)(imv_swid_state_t *this, int tag_id_count, int tag_count,
TNC_UInt32 imc_id);
/** /**
* Set [or with multiple attributes increment] SWID Tag [ID] counters * Set [or with multiple attributes increment] SWID Tag [ID] counters
@ -124,6 +126,13 @@ struct imv_swid_state_t {
* @param tag_count Number of received SWID Tags * @param tag_count Number of received SWID Tags
*/ */
void (*get_count)(imv_swid_state_t *this, int *tag_id_count, int *tag_count); void (*get_count)(imv_swid_state_t *this, int *tag_id_count, int *tag_count);
/**
* Get SWID IMC ID
*
* @return SWID IMC ID
*/
TNC_UInt32 (*get_imc_id)(imv_swid_state_t *this);
}; };
/** /**