implemented IETF Operational Status attribute
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <ietf/ietf_attr_default_pwd_enabled.h>
|
||||
#include <ietf/ietf_attr_fwd_enabled.h>
|
||||
#include <ietf/ietf_attr_installed_packages.h>
|
||||
#include <ietf/ietf_attr_op_status.h>
|
||||
#include <ietf/ietf_attr_pa_tnc_error.h>
|
||||
#include <ietf/ietf_attr_product_info.h>
|
||||
#include <ietf/ietf_attr_string_version.h>
|
||||
@@ -139,6 +140,25 @@ static void add_string_version(linked_list_t *attr_list)
|
||||
attr_list->insert_last(attr_list, attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add IETF Operational Status attribute to the send queue
|
||||
*/
|
||||
static void add_op_status(linked_list_t *attr_list)
|
||||
{
|
||||
pa_tnc_attr_t *attr;
|
||||
time_t uptime, last_boot;
|
||||
|
||||
uptime = os->get_uptime(os);
|
||||
last_boot = uptime ? time(NULL) - uptime : UNDEFINED_TIME;
|
||||
if (last_boot != UNDEFINED_TIME)
|
||||
{
|
||||
DBG1(DBG_IMC, "last boot: %T, %u s ago", &last_boot, TRUE, uptime);
|
||||
}
|
||||
attr = ietf_attr_op_status_create(OP_STATUS_OPERATIONAL,
|
||||
OP_RESULT_SUCCESSFUL, last_boot);
|
||||
attr_list->insert_last(attr_list, attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add IETF Forwarding Enabled attribute to the send queue
|
||||
*/
|
||||
@@ -207,6 +227,7 @@ TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
||||
attr_list = linked_list_create();
|
||||
add_product_info(attr_list);
|
||||
add_string_version(attr_list);
|
||||
add_op_status(attr_list);
|
||||
add_fwd_enabled(attr_list);
|
||||
add_default_pwd_enabled(attr_list);
|
||||
result = imc_os->send_message(imc_os, connection_id, FALSE, 0,
|
||||
@@ -296,6 +317,9 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
|
||||
case IETF_ATTR_STRING_VERSION:
|
||||
add_string_version(attr_list);
|
||||
break;
|
||||
case IETF_ATTR_OPERATIONAL_STATUS:
|
||||
add_op_status(attr_list);
|
||||
break;
|
||||
case IETF_ATTR_FORWARDING_ENABLED:
|
||||
add_fwd_enabled(attr_list);
|
||||
break;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <ietf/ietf_attr_default_pwd_enabled.h>
|
||||
#include <ietf/ietf_attr_fwd_enabled.h>
|
||||
#include <ietf/ietf_attr_installed_packages.h>
|
||||
#include <ietf/ietf_attr_op_status.h>
|
||||
#include <ietf/ietf_attr_pa_tnc_error.h>
|
||||
#include <ietf/ietf_attr_product_info.h>
|
||||
#include <ietf/ietf_attr_string_version.h>
|
||||
@@ -181,6 +182,22 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IETF_ATTR_OPERATIONAL_STATUS:
|
||||
{
|
||||
ietf_attr_op_status_t *attr_cast;
|
||||
op_status_t op_status;
|
||||
op_result_t op_result;
|
||||
time_t last_boot;
|
||||
|
||||
attr_cast = (ietf_attr_op_status_t*)attr;
|
||||
op_status = attr_cast->get_status(attr_cast);
|
||||
op_result = attr_cast->get_result(attr_cast);
|
||||
last_boot = attr_cast->get_last_use(attr_cast);
|
||||
DBG1(DBG_IMV, "operational status: %N, result: %N",
|
||||
op_status_names, op_status, op_result_names, op_result);
|
||||
DBG1(DBG_IMV, "last boot: %T", &last_boot, TRUE);
|
||||
break;
|
||||
}
|
||||
case IETF_ATTR_FORWARDING_ENABLED:
|
||||
{
|
||||
ietf_attr_fwd_enabled_t *attr_cast;
|
||||
@@ -364,6 +381,7 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
|
||||
IETF_ATTR_PRODUCT_INFORMATION);
|
||||
attr_cast = (ietf_attr_attr_request_t*)attr;
|
||||
attr_cast->add(attr_cast, PEN_IETF, IETF_ATTR_STRING_VERSION);
|
||||
attr_cast->add(attr_cast, PEN_IETF, IETF_ATTR_OPERATIONAL_STATUS);
|
||||
attr_cast->add(attr_cast, PEN_IETF, IETF_ATTR_FORWARDING_ENABLED);
|
||||
attr_cast->add(attr_cast, PEN_IETF, IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED);
|
||||
attr_list->insert_last(attr_list, attr);
|
||||
|
||||
Reference in New Issue
Block a user