changed VENDOR_ID to PEN
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 29 May 2011 08:48:55 +0000 (10:48 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 29 May 2011 08:48:55 +0000 (10:48 +0200)
src/libcharon/plugins/tnccs_20/batch/pb_tnc_batch.c
src/libcharon/plugins/tnccs_20/messages/pb_error_msg.c
src/libcharon/plugins/tnccs_20/messages/pb_pa_msg.c
src/libcharon/plugins/tnccs_20/tnccs_20.c

index 3f38543..f386132 100644 (file)
@@ -23,6 +23,7 @@
 #include <tls_writer.h>
 #include <tls_reader.h>
 #include <tnc/tnccs/tnccs.h>
+#include <tnc/pen/pen.h>
 
 ENUM(pb_tnc_batch_type_names, PB_BATCH_CDATA, PB_BATCH_CLOSE,
        "CDATA",
@@ -178,7 +179,7 @@ METHOD(pb_tnc_batch_t, build, void,
                        flags |= PB_TNC_FLAG_NOSKIP;
                }
                writer->write_uint8 (writer, flags);
-               writer->write_uint24(writer, IETF_VENDOR_ID);
+               writer->write_uint24(writer, PEN_IETF);
                writer->write_uint32(writer, msg_type);
                writer->write_uint32(writer, msg_len);
                writer->write_data  (writer, msg_value);
@@ -203,7 +204,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this,
        {
                DBG1(DBG_TNC, "%u bytes insufficient to parse PB-TNC batch header",
                                           this->encoding.len);
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, 0);
                goto fatal;
        }
@@ -220,7 +221,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this,
        if (version != PB_TNC_VERSION)
        {
                DBG1(DBG_TNC, "unsupported TNCCS batch version 0x%01x", version);
-               msg = pb_error_msg_create(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create(TRUE, PEN_IETF,
                                                                  PB_ERROR_VERSION_NOT_SUPPORTED);
                err_msg = (pb_error_msg_t*)msg;
                err_msg->set_bad_version(err_msg, version);
@@ -233,7 +234,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this,
        {
                DBG1(DBG_TNC, "wrong Directionality: batch is from a PB %s",
                         directionality ? "server" : "client");
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, 1);
                goto fatal;
        }
@@ -243,7 +244,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this,
        if (this->type > PB_BATCH_ROOF)
        {
                DBG1(DBG_TNC, "unknown PB-TNC batch type: %d", this->type);
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, 3);
                goto fatal;
        }
@@ -252,7 +253,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this,
        {
                DBG1(DBG_TNC, "unexpected PB-TNC batch type: %N",
                                           pb_tnc_batch_type_names, this->type);
-               msg = pb_error_msg_create(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create(TRUE, PEN_IETF,
                                                                  PB_ERROR_UNEXPECTED_BATCH_TYPE);
                goto fatal;
        }
@@ -262,7 +263,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this,
        {
                DBG1(DBG_TNC, "%u bytes of data is not equal to batch length of %u bytes",
                                           this->encoding.len, batch_len);
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, 4);
                goto fatal;
        }
@@ -291,7 +292,7 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
        {
                DBG1(DBG_TNC, "%u bytes insufficient to parse PB-TNC message header",
                                          data.len);
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, this->offset);
                goto fatal;
        }
@@ -308,15 +309,15 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
        if (msg_len > data.len)
        {
                DBG1(DBG_TNC, "%u bytes insufficient to parse PB-TNC message", data.len);
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, this->offset + 8);
                goto fatal;
        }
 
-       if (vendor_id == RESERVED_VENDOR_ID)
+       if (vendor_id == PEN_RESERVED)
        {
-               DBG1(DBG_TNC, "Vendor ID 0x%06x is reserved", RESERVED_VENDOR_ID);
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               DBG1(DBG_TNC, "Vendor ID 0x%06x is reserved", PEN_RESERVED);
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, this->offset + 1);
                goto fatal;
 
@@ -326,19 +327,19 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
        {
                DBG1(DBG_TNC, "PB-TNC message Type 0x%08x is reserved",
                         PB_TNC_RESERVED_MSG_TYPE);
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, this->offset + 4);
                goto fatal;
        }
 
 
-       if (vendor_id != IETF_VENDOR_ID || msg_type > PB_MSG_ROOF)
+       if (vendor_id != PEN_IETF || msg_type > PB_MSG_ROOF)
        {
                if (msg_len < PB_TNC_HEADER_SIZE)
                {
                        DBG1(DBG_TNC, "%u bytes too small for PB-TNC message length",
                                                   msg_len);
-                       msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+                       msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, this->offset + 8);
                        goto fatal;
                }
@@ -347,7 +348,7 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
                {
                        DBG1(DBG_TNC, "reject PB-TNC message (Vendor ID 0x%06x / "
                                                  "Type 0x%08x)", vendor_id, msg_type);
-                       msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+                       msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_UNSUPPORTED_MANDATORY_MSG, this->offset);
                        goto fatal;
                }
@@ -367,7 +368,7 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
                        DBG1(DBG_TNC, "%N message must%s have NOSKIP flag set",
                                 pb_tnc_msg_type_names, msg_type,
                                 pb_tnc_msg_infos[msg_type].has_noskip_flag ? "" : " not");
-                       msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+                       msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                                PB_ERROR_INVALID_PARAMETER, this->offset);
                        goto fatal;
                }
@@ -380,7 +381,7 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
                                 pb_tnc_msg_type_names, msg_type,
                                 pb_tnc_msg_infos[msg_type].exact_size ? "exactly" : "at least",
                                 pb_tnc_msg_infos[msg_type].min_size, msg_len);
-                       msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+                       msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                                PB_ERROR_INVALID_PARAMETER, this->offset);
                        goto fatal;
                }
@@ -393,7 +394,7 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
                {
                        DBG1(DBG_TNC,"reject %N message received from a PB-TNC client",
                                                  pb_tnc_msg_type_names, msg_type);
-                       msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+                       msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                                PB_ERROR_INVALID_PARAMETER, this->offset);
                        goto fatal;
                }
@@ -415,7 +416,7 @@ static status_t process_tnc_msg(private_pb_tnc_batch_t *this)
        status = pb_tnc_msg->process(pb_tnc_msg, &offset);
        if (status == FAILED || status == VERIFY_ERROR)
        {
-               msg = pb_error_msg_create_with_offset(TRUE, IETF_VENDOR_ID,
+               msg = pb_error_msg_create_with_offset(TRUE, PEN_IETF,
                                                        PB_ERROR_INVALID_PARAMETER, this->offset);
                this->errors->insert_last(this->errors, msg);
        }
index e1755c5..40dfd14 100644 (file)
@@ -19,6 +19,7 @@
 #include <tls_writer.h>
 #include <tls_reader.h>
 #include <tnc/tnccs/tnccs.h>
+#include <tnc/pen/pen.h>
 
 ENUM(pb_tnc_error_code_names, PB_ERROR_UNEXPECTED_BATCH_TYPE,
                                                          PB_ERROR_VERSION_NOT_SUPPORTED,
@@ -169,7 +170,7 @@ METHOD(pb_tnc_msg_t, process, status_t,
        reader->read_uint16(reader, &reserved);
        this->fatal = (flags & ERROR_FLAG_FATAL) != ERROR_FLAG_NONE;
 
-       if (this->vendor_id == IETF_VENDOR_ID && reader->remaining(reader) == 4)
+       if (this->vendor_id == PEN_IETF && reader->remaining(reader) == 4)
        {
                if (this->error_code == PB_ERROR_VERSION_NOT_SUPPORTED)
                {
index 8315bfb..efcc7d7 100644 (file)
@@ -20,6 +20,7 @@
 #include <tls_writer.h>
 #include <tls_reader.h>
 #include <tnc/tnccs/tnccs.h>
+#include <tnc/pen/pen.h>
 #include <debug.h>
 
 ENUM(pa_tnc_subtype_names, PA_SUBTYPE_TESTING, PA_SUBTYPE_NEA_CLIENT,
@@ -166,9 +167,9 @@ METHOD(pb_tnc_msg_t, process, status_t,
        }
        reader->destroy(reader);
 
-       if (this->vendor_id == RESERVED_VENDOR_ID)
+       if (this->vendor_id == PEN_RESERVED)
        {
-               DBG1(DBG_TNC, "Vendor ID 0x%06x is reserved", RESERVED_VENDOR_ID);
+               DBG1(DBG_TNC, "Vendor ID 0x%06x is reserved", PEN_RESERVED);
                *offset = 1;
                return FAILED;
        }
index 9e2081d..3d7853d 100644 (file)
@@ -32,6 +32,7 @@
 #include <tnc/tncif.h>
 #include <tnc/tncifimv.h>
 #include <tnc/tnccs/tnccs.h>
+#include <tnc/pen/pen.h>
 
 typedef struct private_tnccs_20_t private_tnccs_20_t;
 
@@ -115,6 +116,8 @@ METHOD(tnccs_t, send_msg, TNC_Result,
 
        pb_tnc_msg = pb_pa_msg_create(msg_vendor_id, msg_sub_type, imc_id, imv_id,
                                                                          chunk_create(msg, msg_len));
+       DBG2(DBG_TNC, "creating PB-PA message type 0x%06x(%N)/0x%02x",
+                                  msg_vendor_id, pen_names, msg_vendor_id, msg_sub_type);
 
        /* adding PA message to SDATA or CDATA batch only */
        batch_type = this->is_server ? PB_BATCH_SDATA : PB_BATCH_CDATA;
@@ -157,7 +160,8 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
                        msg_type = (vendor_id << 8) | (subtype & 0xff);
                        msg_body = pa_msg->get_body(pa_msg);
 
-                       DBG2(DBG_TNC, "handling PB-PA message type 0x%08x", msg_type);
+                       DBG2(DBG_TNC, "handling PB-PA message type 0x%06x(%N)/0x%02x",
+                                                  vendor_id, pen_names, vendor_id, subtype);
 
                        this->send_msg = TRUE;
                        if (this->is_server)
@@ -231,7 +235,7 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
                                this->fatal_error = TRUE;
                        }
 
-                       if (vendor_id == IETF_VENDOR_ID)
+                       if (vendor_id == PEN_IETF)
                        {
                                switch (error_code)
                                {