introduced sending of standard IETF Assessment Result PA-TNC attribute by IMVs

This commit is contained in:
Andreas Steffen
2012-09-09 05:13:50 +02:00
parent bcf8cdd556
commit 6f93927b6c
21 changed files with 639 additions and 84 deletions
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
* Copyright (C) 2010-2012 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -280,6 +281,24 @@ METHOD(recommendations_t, have_recommendation, bool,
return TRUE;
}
METHOD(recommendations_t, clear_recommendation, void,
private_tnc_imv_recommendations_t *this)
{
enumerator_t *enumerator;
recommendation_entry_t *entry;
enumerator = this->recs->create_enumerator(this->recs);
while (enumerator->enumerate(enumerator, &entry))
{
entry->have_recommendation = FALSE;
entry->rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION;
entry->eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
chunk_clear(&entry->reason);
chunk_clear(&entry->reason_language);
}
enumerator->destroy(enumerator);
}
METHOD(recommendations_t, get_preferred_language, chunk_t,
private_tnc_imv_recommendations_t *this)
{
@@ -370,21 +389,6 @@ METHOD(recommendations_t, create_reason_enumerator, enumerator_t*,
(void*)reason_filter, NULL, NULL);
}
METHOD(recommendations_t, clear_reasons, void,
private_tnc_imv_recommendations_t *this)
{
enumerator_t *enumerator;
recommendation_entry_t *entry;
enumerator = this->recs->create_enumerator(this->recs);
while (enumerator->enumerate(enumerator, &entry))
{
chunk_clear(&entry->reason);
chunk_clear(&entry->reason_language);
}
enumerator->destroy(enumerator);
}
METHOD(recommendations_t, destroy, void,
private_tnc_imv_recommendations_t *this)
{
@@ -415,12 +419,12 @@ recommendations_t* tnc_imv_recommendations_create(linked_list_t *imv_list)
.public = {
.provide_recommendation = _provide_recommendation,
.have_recommendation = _have_recommendation,
.clear_recommendation = _clear_recommendation,
.get_preferred_language = _get_preferred_language,
.set_preferred_language = _set_preferred_language,
.set_reason_string = _set_reason_string,
.set_reason_language = _set_reason_language,
.create_reason_enumerator = _create_reason_enumerator,
.clear_reasons = _clear_reasons,
.destroy = _destroy,
},
.recs = linked_list_create(),
@@ -403,7 +403,6 @@ static void check_and_build_recommendation(private_tnccs_11_t *this)
this->batch->add_msg(this->batch, msg);
}
enumerator->destroy(enumerator);
this->recs->clear_reasons(this->recs);
/* we have reache the final state */
this->delete_state = TRUE;
+8 -3
View File
@@ -398,6 +398,7 @@ static void build_retry_batch(private_tnccs_20_t *this)
if (this->is_server)
{
this->recs->clear_recommendation(this->recs);
tnc->imvs->notify_connection_change(tnc->imvs, this->connection_id,
TNC_CONNECTION_STATE_HANDSHAKE);
}
@@ -574,7 +575,6 @@ static void check_and_build_recommendation(private_tnccs_20_t *this)
this->messages->insert_last(this->messages, msg);
}
enumerator->destroy(enumerator);
this->recs->clear_reasons(this->recs);
}
}
@@ -639,12 +639,17 @@ METHOD(tls_t, build, status_t,
this->request_handshake_retry = FALSE;
}
if (this->is_server && state == PB_STATE_SERVER_WORKING &&
this->recs->have_recommendation(this->recs, NULL, NULL))
{
check_and_build_recommendation(this);
}
if (this->batch_type == PB_BATCH_NONE)
{
if (this->is_server && state == PB_STATE_SERVER_WORKING)
{
if (this->state_machine->get_empty_cdata(this->state_machine) ||
this->recs->have_recommendation(this->recs, NULL, NULL))
if (this->state_machine->get_empty_cdata(this->state_machine))
{
check_and_build_recommendation(this);
}