implemented the Forwarding Enabled attribute

This commit is contained in:
Andreas Steffen
2012-10-12 09:49:44 +02:00
parent 230a26ed01
commit ca1a64742f
8 changed files with 390 additions and 5 deletions
+20 -2
View File
@@ -20,6 +20,7 @@
#include <ietf/ietf_attr.h>
#include <ietf/ietf_attr_assess_result.h>
#include <ietf/ietf_attr_attr_request.h>
#include <ietf/ietf_attr_fwd_enabled.h>
#include <ietf/ietf_attr_installed_packages.h>
#include <ietf/ietf_attr_pa_tnc_error.h>
#include <ietf/ietf_attr_product_info.h>
@@ -31,8 +32,6 @@
#include <pen/pen.h>
#include <debug.h>
#include <stdio.h>
/* IMC definitions */
static const char imc_name[] = "OS";
@@ -139,6 +138,21 @@ static void add_string_version(linked_list_t *attr_list)
attr_list->insert_last(attr_list, attr);
}
/**
* Add IETF Forwarding Enabled attribute to the send queue
*/
static void add_fwd_enabled(linked_list_t *attr_list)
{
pa_tnc_attr_t *attr;
os_fwd_status_t fwd_status;
fwd_status = os->get_fwd_status(os);
DBG1(DBG_IMC, "IPv4 forwarding status: %N",
os_fwd_status_names, fwd_status);
attr = ietf_attr_fwd_enabled_create(fwd_status);
attr_list->insert_last(attr_list, attr);
}
/**
* Add an IETF Installed Packages attribute to the send queue
*/
@@ -180,6 +194,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_fwd_enabled(attr_list);
result = imc_os->send_message(imc_os, connection_id, FALSE, 0,
TNC_IMVID_ANY, attr_list);
attr_list->destroy(attr_list);
@@ -267,6 +282,9 @@ static TNC_Result receive_message(TNC_IMCID imc_id,
case IETF_ATTR_STRING_VERSION:
add_string_version(attr_list);
break;
case IETF_ATTR_FORWARDING_ENABLED:
add_fwd_enabled(attr_list);
break;
case IETF_ATTR_INSTALLED_PACKAGES:
add_installed_packages(attr_list);
break;
+14
View File
@@ -19,10 +19,12 @@
#include <pa_tnc/pa_tnc_msg.h>
#include <ietf/ietf_attr.h>
#include <ietf/ietf_attr_attr_request.h>
#include <ietf/ietf_attr_fwd_enabled.h>
#include <ietf/ietf_attr_installed_packages.h>
#include <ietf/ietf_attr_pa_tnc_error.h>
#include <ietf/ietf_attr_product_info.h>
#include <ietf/ietf_attr_string_version.h>
#include <os_info/os_info.h>
#include <tncif_names.h>
#include <tncif_pa_subtypes.h>
@@ -178,6 +180,17 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
}
break;
}
case IETF_ATTR_FORWARDING_ENABLED:
{
ietf_attr_fwd_enabled_t *attr_cast;
os_fwd_status_t fwd_status;
attr_cast = (ietf_attr_fwd_enabled_t*)attr;
fwd_status = attr_cast->get_status(attr_cast);
DBG1(DBG_IMV, "IPv4 forwarding status: %N",
os_fwd_status_names, fwd_status);
break;
}
case IETF_ATTR_INSTALLED_PACKAGES:
{
ietf_attr_installed_packages_t *attr_cast;
@@ -339,6 +352,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_FORWARDING_ENABLED);
attr_list->insert_last(attr_list, attr);
result = imv_os->send_message(imv_os, connection_id, FALSE, imv_id,
TNC_IMCID_ANY, attr_list);