From 755f2419a586f6f7b49ed761613260de4a806f6a Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Fri, 10 Dec 2010 11:54:51 +0100 Subject: [PATCH] debug cosmetics --- .../plugins/tnccs_20/batch/pb_tnc_batch.c | 11 +++++---- src/libcharon/plugins/tnccs_20/tnccs_20.c | 23 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/libcharon/plugins/tnccs_20/batch/pb_tnc_batch.c b/src/libcharon/plugins/tnccs_20/batch/pb_tnc_batch.c index d8e937fae..edada34e3 100644 --- a/src/libcharon/plugins/tnccs_20/batch/pb_tnc_batch.c +++ b/src/libcharon/plugins/tnccs_20/batch/pb_tnc_batch.c @@ -325,7 +325,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this, /* Version */ if (version != PB_TNC_VERSION) { - DBG1(DBG_TNC, "Unsupported TNCCS Batch Version 0x%01x", version); + DBG1(DBG_TNC, "unsupported TNCCS Batch Version 0x%01x", version); msg = pb_error_message_create(TRUE, IETF_VENDOR_ID, PB_ERROR_VERSION_NOT_SUPPORTED); err_msg = (pb_error_message_t*)msg; @@ -337,7 +337,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this, directionality = (flags & PB_TNC_BATCH_FLAG_D) != PB_TNC_BATCH_FLAG_NONE; if (directionality == this->is_server) { - DBG1(DBG_TNC, "Wrong Directionality: Batch is from a PB %s", + DBG1(DBG_TNC, "wrong Directionality: Batch is from a PB %s", directionality ? "Server" : "Client"); msg = pb_error_message_create(TRUE, IETF_VENDOR_ID, PB_ERROR_INVALID_PARAMETER); @@ -350,7 +350,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this, this->type = type & 0x0F; if (this->type > PB_BATCH_ROOF) { - DBG1(DBG_TNC, "Unknown PB-TNC Batch Type: %d", this->type); + DBG1(DBG_TNC, "unknown PB-TNC Batch Type: %d", this->type); msg = pb_error_message_create(TRUE, IETF_VENDOR_ID, PB_ERROR_INVALID_PARAMETER); err_msg = (pb_error_message_t*)msg; @@ -360,7 +360,7 @@ static status_t process_batch_header(private_pb_tnc_batch_t *this, if (!state_transition_upon_receive(state, this->type, this->is_server)) { - DBG1(DBG_TNC, "Unexpected PB-TNC Batch Type: %N", + DBG1(DBG_TNC, "unexpected PB-TNC Batch Type: %N", pb_tnc_batch_type_names, this->type); msg = pb_error_message_create(TRUE, IETF_VENDOR_ID, PB_ERROR_UNEXPECTED_BATCH_TYPE); @@ -523,7 +523,8 @@ METHOD(pb_tnc_batch_t, process, status_t, { return FAILED; } - + DBG1(DBG_TNC, "processing PB-TNC %N Batch", pb_tnc_batch_type_names, + this->type); while (this->offset < this->encoding.len) { status = process_tnc_message(this); diff --git a/src/libcharon/plugins/tnccs_20/tnccs_20.c b/src/libcharon/plugins/tnccs_20/tnccs_20.c index 48d7c93dd..8bf88a270 100644 --- a/src/libcharon/plugins/tnccs_20/tnccs_20.c +++ b/src/libcharon/plugins/tnccs_20/tnccs_20.c @@ -195,31 +195,38 @@ static status_t handle_messages(private_tnccs_20_t *this, pb_tnc_batch_t *batch) if (vendor_id == IETF_VENDOR_ID) { - DBG1(DBG_TNC, "%s PB-TNC Error: %N", - fatal ? "fatal" : "non-fatal", - pb_tnc_error_code_names, error_code); - switch (error_code) { case PB_ERROR_INVALID_PARAMETER: case PB_ERROR_UNSUPPORTED_MANDATORY_MESSAGE: - DBG1(DBG_TNC, " at an offset of %u bytes", + DBG1(DBG_TNC, "received %s PB-TNC Error '%N' " + "(offset %u bytes)", + fatal ? "fatal" : "non-fatal", + pb_tnc_error_code_names, error_code, err_msg->get_offset(err_msg)); break; case PB_ERROR_VERSION_NOT_SUPPORTED: - DBG1(DBG_TNC, " with bad version 0x%02x", + DBG1(DBG_TNC, "received %s PB-TNC Error '%N' " + "caused by bad version 0x%02x", + fatal ? "fatal" : "non-fatal", + pb_tnc_error_code_names, error_code, err_msg->get_bad_version(err_msg)); break; case PB_ERROR_UNEXPECTED_BATCH_TYPE: case PB_ERROR_LOCAL_ERROR: default: + DBG1(DBG_TNC, "received %s PB-TNC Error '%N'", + fatal ? "fatal" : "non-fatal", + pb_tnc_error_code_names, error_code); break; } } else { - DBG1(DBG_TNC, "%s PB-TNC Error (%u) with Vendor ID 0x%06x", - fatal ? "fatal" : "non-fatal", error_code, vendor_id); + DBG1(DBG_TNC, "received %s PB-TNC Error (%u) " + "with Vendor ID 0x%06x", + fatal ? "fatal" : "non-fatal", + error_code, vendor_id); } break; }