libimcv: Reset of IMC state for new measurement cycle
This commit is contained in:
@@ -410,6 +410,7 @@ METHOD(imc_agent_t, change_state, TNC_Result,
|
||||
imc_state_t **state_p)
|
||||
{
|
||||
imc_state_t *state;
|
||||
TNC_ConnectionState old_state;
|
||||
|
||||
switch (new_state)
|
||||
{
|
||||
@@ -425,7 +426,7 @@ METHOD(imc_agent_t, change_state, TNC_Result,
|
||||
this->id, this->name, connection_id);
|
||||
return TNC_RESULT_FATAL;
|
||||
}
|
||||
state->change_state(state, new_state);
|
||||
old_state = state->change_state(state, new_state);
|
||||
DBG2(DBG_IMC, "IMC %u \"%s\" changed state of Connection ID %u to '%N'",
|
||||
this->id, this->name, connection_id,
|
||||
TNC_Connection_State_names, new_state);
|
||||
@@ -433,6 +434,13 @@ METHOD(imc_agent_t, change_state, TNC_Result,
|
||||
{
|
||||
*state_p = state;
|
||||
}
|
||||
if (new_state == TNC_CONNECTION_STATE_HANDSHAKE &&
|
||||
old_state != TNC_CONNECTION_STATE_CREATE)
|
||||
{
|
||||
state->reset(state);
|
||||
DBG2(DBG_IMC, "IMC %u \"%s\" reset state of Connection ID %u",
|
||||
this->id, this->name, connection_id);
|
||||
}
|
||||
break;
|
||||
case TNC_CONNECTION_STATE_CREATE:
|
||||
DBG1(DBG_IMC, "state '%N' should be handled by create_state()",
|
||||
|
||||
@@ -92,8 +92,10 @@ struct imc_state_t {
|
||||
* Change the connection state
|
||||
*
|
||||
* @param new_state new connection state
|
||||
* @return old connection state
|
||||
*/
|
||||
void (*change_state)(imc_state_t *this, TNC_ConnectionState new_state);
|
||||
TNC_ConnectionState (*change_state)(imc_state_t *this,
|
||||
TNC_ConnectionState new_state);
|
||||
|
||||
/**
|
||||
* Set the Assessment/Evaluation Result
|
||||
@@ -114,6 +116,11 @@ struct imc_state_t {
|
||||
bool (*get_result)(imc_state_t *this, TNC_IMCID id,
|
||||
TNC_IMV_Evaluation_Result *result);
|
||||
|
||||
/**
|
||||
* Resets the state for a new measurement cycle triggered by a SRETRY batch
|
||||
*/
|
||||
void (*reset)(imc_state_t *this);
|
||||
|
||||
/**
|
||||
* Destroys an imc_state_t object
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user