list registered TNCCS message types
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user