diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2011-04-28 01:34:03 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2011-04-28 01:35:45 +0200 |
commit | e7f21e33b19430bddb5ec66756cc947c723d78b8 (patch) | |
tree | db3a8b2671a1696b5e9ad5c18273c33ab0ef9fd2 /src | |
parent | 67ec2be6653b528bb1a04f5aa3fc0c45276c5ed1 (diff) | |
download | strongswan-e7f21e33b19430bddb5ec66756cc947c723d78b8.tar.bz2 strongswan-e7f21e33b19430bddb5ec66756cc947c723d78b8.tar.xz |
list registered TNCCS message types
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/tnc_imc/tnc_imc.c | 20 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_imv/tnc_imv.c | 21 |
2 files changed, 39 insertions, 2 deletions
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc.c b/src/libcharon/plugins/tnc_imc/tnc_imc.c index 174084436..21dda29ab 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc.c @@ -85,6 +85,11 @@ METHOD(imc_t, set_message_types, void, private_tnc_imc_t *this, TNC_MessageTypeList supported_types, TNC_UInt32 type_count) { + char buf[512]; + char *pos = buf; + int len = sizeof(buf); + int written; + /* Free an existing MessageType list */ free(this->supported_types); this->supported_types = NULL; @@ -94,11 +99,24 @@ METHOD(imc_t, set_message_types, void, if (type_count && supported_types) { size_t size = type_count * sizeof(TNC_MessageType); + int i; + for (i = 0; i < type_count; i++) + { + written = snprintf(pos, len, " 0x%08x", supported_types[i]); + if (written >= len) + { + break; + } + pos += written; + len -= written; + } this->supported_types = malloc(size); memcpy(this->supported_types, supported_types, size); } - DBG2(DBG_TNC, "IMC %u supports %u message types", this->id, type_count); + *pos = '\0'; + DBG2(DBG_TNC, "IMC %u supports %u message types:%s", + this->id, type_count, buf); } METHOD(imc_t, type_supported, bool, diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv.c b/src/libcharon/plugins/tnc_imv/tnc_imv.c index f88b645d6..dffe542b7 100644 --- a/src/libcharon/plugins/tnc_imv/tnc_imv.c +++ b/src/libcharon/plugins/tnc_imv/tnc_imv.c @@ -85,6 +85,11 @@ METHOD(imv_t, set_message_types, void, private_tnc_imv_t *this, TNC_MessageTypeList supported_types, TNC_UInt32 type_count) { + char buf[512]; + char *pos = buf; + int len = sizeof(buf); + int written; + /* Free an existing MessageType list */ free(this->supported_types); this->supported_types = NULL; @@ -95,10 +100,24 @@ METHOD(imv_t, set_message_types, void, { size_t size = type_count * sizeof(TNC_MessageType); + int i; + + for (i = 0; i < type_count; i++) + { + written = snprintf(pos, len, " 0x%08x", supported_types[i]); + if (written >= len) + { + break; + } + pos += written; + len -= written; + } this->supported_types = malloc(size); memcpy(this->supported_types, supported_types, size); } - DBG2(DBG_TNC, "IMV %u supports %u message types", this->id, type_count); + *pos = '\0'; + DBG2(DBG_TNC, "IMC %u supports %u message types:%s", + this->id, type_count, buf); } METHOD(imv_t, type_supported, bool, |