added TNC_TNCC_ReportMessageTypesLong() and TNC_TNCS_ReportMessageTypesLong() messages

This commit is contained in:
Andreas Steffen
2011-12-06 23:39:01 +01:00
parent a91462df09
commit 10b9d52400
11 changed files with 464 additions and 123 deletions
+117 -21
View File
@@ -17,6 +17,8 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <tncif_pa_subtypes.h>
#include <debug.h> #include <debug.h>
#include <library.h> #include <library.h>
#include <threading/mutex.h> #include <threading/mutex.h>
@@ -54,9 +56,14 @@ struct private_tnc_imc_t {
TNC_IMCID id; TNC_IMCID id;
/** /**
* List of message types supported by IMC * List of message types supported by IMC - Vendor ID part
*/ */
TNC_MessageTypeList supported_types; TNC_VendorIDList supported_vids;
/**
* List of message types supported by IMC - Subtype part
*/
TNC_MessageSubtypeList supported_subtypes;
/** /**
* Number of supported message types * Number of supported message types
@@ -91,28 +98,119 @@ METHOD(imc_t, set_message_types, void,
private_tnc_imc_t *this, TNC_MessageTypeList supported_types, private_tnc_imc_t *this, TNC_MessageTypeList supported_types,
TNC_UInt32 type_count) TNC_UInt32 type_count)
{ {
char buf[512]; char buf[BUF_LEN];
char *pos = buf; char *pos = buf;
int len = sizeof(buf); int len = sizeof(buf);
int written; int i, written;
size_t size;
TNC_VendorID vid;
TNC_MessageSubtype subtype;
enum_name_t *pa_subtype_names;
/* lock the imc_t instance */ /* lock the imc_t instance */
this->mutex->lock(this->mutex); this->mutex->lock(this->mutex);
/* Free an existing MessageType list */ /* Free existing VendorID and MessageSubtype lists */
free(this->supported_types); free(this->supported_vids);
this->supported_types = NULL; this->supported_vids = NULL;
free(this->supported_subtypes);
this->supported_subtypes = NULL;
/* Store the new MessageType list */ /* Store the new MessageType list */
this->type_count = type_count; this->type_count = type_count;
if (type_count && supported_types) if (type_count && supported_types)
{ {
size_t size = type_count * sizeof(TNC_MessageType); size = type_count * sizeof(TNC_VendorID);
int i; this->supported_vids = malloc(size);
size = type_count * sizeof(TNC_MessageSubtype);
this->supported_subtypes = malloc(size);
for (i = 0; i < type_count; i++) for (i = 0; i < type_count; i++)
{ {
written = snprintf(pos, len, " 0x%08x", supported_types[i]); vid = (supported_types[i] >> 8) & TNC_VENDORID_ANY;
subtype = supported_types[i] & TNC_SUBTYPE_ANY;
pa_subtype_names = get_pa_subtype_names(vid);
if (pa_subtype_names)
{
written = snprintf(pos, len," '%N/%N' 0x%06x/0x%02x",
pen_names, vid, pa_subtype_names, subtype,
vid, subtype);
}
else
{
written = snprintf(pos, len," '%N' 0x%06x/0x%02x",
pen_names, vid, vid, subtype);
}
if (written >= len)
{
break;
}
pos += written;
len -= written;
this->supported_vids[i] = vid;
this->supported_subtypes[i] = subtype;
}
}
*pos = '\0';
DBG2(DBG_TNC, "IMC %u supports %u message type%s:%s",
this->id, type_count, (type_count == 1) ? "":"s", buf);
/* unlock the imc_t instance */
this->mutex->unlock(this->mutex);
}
METHOD(imc_t, set_message_types_long, void,
private_tnc_imc_t *this, TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes, TNC_UInt32 type_count)
{
char buf[BUF_LEN];
char *pos = buf;
int len = sizeof(buf);
int i, written;
size_t size;
TNC_VendorID vid;
TNC_MessageSubtype subtype;
enum_name_t *pa_subtype_names;
/* lock the imc_t instance */
this->mutex->lock(this->mutex);
/* Free existing VendorID and MessageSubtype lists */
free(this->supported_vids);
this->supported_vids = NULL;
free(this->supported_subtypes);
this->supported_subtypes = NULL;
/* Store the new MessageType list */
this->type_count = type_count;
if (type_count && supported_vids && supported_subtypes)
{
size = type_count * sizeof(TNC_VendorID);
this->supported_vids = malloc(size);
memcpy(this->supported_vids, supported_vids, size);
size = type_count * sizeof(TNC_MessageSubtype);
this->supported_subtypes = malloc(size);
memcpy(this->supported_subtypes, supported_subtypes, size);
for (i = 0; i < type_count; i++)
{
vid = supported_vids[i];
subtype = supported_subtypes[i];
pa_subtype_names = get_pa_subtype_names(vid);
if (pa_subtype_names)
{
written = snprintf(pos, len," '%N/%N' 0x%06x/0x%08x",
pen_names, vid, pa_subtype_names, subtype,
vid, subtype);
}
else
{
written = snprintf(pos, len," '%N' 0x%06x/0x%08x",
pen_names, vid, vid, subtype);
}
if (written >= len) if (written >= len)
{ {
break; break;
@@ -120,14 +218,12 @@ METHOD(imc_t, set_message_types, void,
pos += written; pos += written;
len -= written; len -= written;
} }
this->supported_types = malloc(size);
memcpy(this->supported_types, supported_types, size);
} }
*pos = '\0'; *pos = '\0';
DBG2(DBG_TNC, "IMC %u supports %u message type%s:%s", DBG2(DBG_TNC, "IMC %u supports %u message type%s:%s",
this->id, type_count, (type_count == 1) ? "":"s", buf); this->id, type_count, (type_count == 1) ? "":"s", buf);
/* lock the imc_t instance */ /* unlock the imc_t instance */
this->mutex->unlock(this->mutex); this->mutex->unlock(this->mutex);
} }
@@ -143,14 +239,12 @@ METHOD(imc_t, type_supported, bool,
for (i = 0; i < this->type_count; i++) for (i = 0; i < this->type_count; i++)
{ {
vid = (this->supported_types[i] >> 8) & TNC_VENDORID_ANY; vid = this->supported_vids[i];
subtype = this->supported_types[i] & TNC_SUBTYPE_ANY; subtype = this->supported_subtypes[i];
if (this->supported_types[i] == message_type if ((vid == TNC_VENDORID_ANY && subtype == TNC_SUBTYPE_ANY) ||
|| (subtype == TNC_SUBTYPE_ANY (vid == msg_vid && (subtype == TNC_SUBTYPE_ANY ||
&& (msg_vid == vid || vid == TNC_VENDORID_ANY)) subtype == msg_subtype)))
|| (vid == TNC_VENDORID_ANY
&& (msg_subtype == subtype || subtype == TNC_SUBTYPE_ANY)))
{ {
return TRUE; return TRUE;
} }
@@ -163,7 +257,8 @@ METHOD(imc_t, destroy, void,
{ {
dlclose(this->handle); dlclose(this->handle);
this->mutex->destroy(this->mutex); this->mutex->destroy(this->mutex);
free(this->supported_types); free(this->supported_vids);
free(this->supported_subtypes);
free(this->name); free(this->name);
free(this->path); free(this->path);
free(this); free(this);
@@ -182,6 +277,7 @@ imc_t* tnc_imc_create(char *name, char *path)
.get_id = _get_id, .get_id = _get_id,
.get_name = _get_name, .get_name = _get_name,
.set_message_types = _set_message_types, .set_message_types = _set_message_types,
.set_message_types_long = _set_message_types_long,
.type_supported = _type_supported, .type_supported = _type_supported,
.destroy = _destroy, .destroy = _destroy,
}, },
@@ -37,6 +37,25 @@ TNC_Result TNC_TNCC_ReportMessageTypes(TNC_IMCID imc_id,
type_count); type_count);
} }
/**
* Called by the IMC to inform a TNCC about the set of message types the IMC
* is able to receive. This function supports long message types.
*/
TNC_Result TNC_TNCC_ReportMessageTypesLong(TNC_IMCID imc_id,
TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes,
TNC_UInt32 type_count)
{
if (!tnc->imcs->is_registered(tnc->imcs, imc_id))
{
DBG1(DBG_TNC, "ignoring ReportMessageTypes() from unregistered IMC %u",
imc_id);
return TNC_RESULT_INVALID_PARAMETER;
}
return tnc->imcs->set_message_types_long(tnc->imcs, imc_id, supported_vids,
supported_subtypes, type_count);
}
/** /**
* Called by the IMC to ask a TNCC to retry an Integrity Check Handshake * Called by the IMC to ask a TNCC to retry an Integrity Check Handshake
*/ */
@@ -84,6 +103,10 @@ TNC_Result TNC_TNCC_BindFunction(TNC_IMCID id,
{ {
*function_pointer = (void*)TNC_TNCC_ReportMessageTypes; *function_pointer = (void*)TNC_TNCC_ReportMessageTypes;
} }
else if (streq(function_name, "TNC_TNCC_ReportMessageTypesLong"))
{
*function_pointer = (void*)TNC_TNCC_ReportMessageTypesLong;
}
else if (streq(function_name, "TNC_TNCC_RequestHandshakeRetry")) else if (streq(function_name, "TNC_TNCC_RequestHandshakeRetry"))
{ {
*function_pointer = (void*)TNC_TNCC_RequestHandshakeRetry; *function_pointer = (void*)TNC_TNCC_RequestHandshakeRetry;
@@ -203,6 +203,31 @@ METHOD(imc_manager_t, set_message_types, TNC_Result,
return result; return result;
} }
METHOD(imc_manager_t, set_message_types_long, TNC_Result,
private_tnc_imc_manager_t *this, TNC_IMCID id,
TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes,
TNC_UInt32 type_count)
{
enumerator_t *enumerator;
imc_t *imc;
TNC_Result result = TNC_RESULT_FATAL;
enumerator = this->imcs->create_enumerator(this->imcs);
while (enumerator->enumerate(enumerator, &imc))
{
if (id == imc->get_id(imc))
{
imc->set_message_types_long(imc, supported_vids, supported_subtypes,
type_count);
result = TNC_RESULT_SUCCESS;
break;
}
}
enumerator->destroy(enumerator);
return result;
}
METHOD(imc_manager_t, receive_message, void, METHOD(imc_manager_t, receive_message, void,
private_tnc_imc_manager_t *this, TNC_ConnectionID connection_id, private_tnc_imc_manager_t *this, TNC_ConnectionID connection_id,
TNC_BufferReference message, TNC_BufferReference message,
@@ -283,6 +308,7 @@ imc_manager_t* tnc_imc_manager_create(void)
.notify_connection_change = _notify_connection_change, .notify_connection_change = _notify_connection_change,
.begin_handshake = _begin_handshake, .begin_handshake = _begin_handshake,
.set_message_types = _set_message_types, .set_message_types = _set_message_types,
.set_message_types_long = _set_message_types_long,
.receive_message = _receive_message, .receive_message = _receive_message,
.batch_ending = _batch_ending, .batch_ending = _batch_ending,
.destroy = _destroy, .destroy = _destroy,
+117 -22
View File
@@ -17,6 +17,8 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <tncif_pa_subtypes.h>
#include <debug.h> #include <debug.h>
#include <library.h> #include <library.h>
#include <threading/mutex.h> #include <threading/mutex.h>
@@ -54,9 +56,14 @@ struct private_tnc_imv_t {
TNC_IMVID id; TNC_IMVID id;
/** /**
* List of message types supported by IMC * List of message types supported by IMV - Vendor ID part
*/ */
TNC_MessageTypeList supported_types; TNC_VendorIDList supported_vids;
/**
* List of message types supported by IMV - Subtype part
*/
TNC_MessageSubtypeList supported_subtypes;
/** /**
* Number of supported message types * Number of supported message types
@@ -91,29 +98,119 @@ METHOD(imv_t, set_message_types, void,
private_tnc_imv_t *this, TNC_MessageTypeList supported_types, private_tnc_imv_t *this, TNC_MessageTypeList supported_types,
TNC_UInt32 type_count) TNC_UInt32 type_count)
{ {
char buf[512]; char buf[BUF_LEN];
char *pos = buf; char *pos = buf;
int len = sizeof(buf); int len = sizeof(buf);
int written; int i, written;
size_t size;
TNC_VendorID vid;
TNC_MessageSubtype subtype;
enum_name_t *pa_subtype_names;
/* lock the imv_t instance */ /* lock the imv_t instance */
this->mutex->lock(this->mutex); this->mutex->lock(this->mutex);
/* Free an existing MessageType list */ /* Free existing VendorID and MessageSubtype lists */
free(this->supported_types); free(this->supported_vids);
this->supported_types = NULL; this->supported_vids = NULL;
free(this->supported_subtypes);
this->supported_subtypes = NULL;
/* Store the new MessageType list */ /* Store the new MessageType list */
this->type_count = type_count; this->type_count = type_count;
if (type_count && supported_types) if (type_count && supported_types)
{ {
size_t size = type_count * sizeof(TNC_MessageType); size = type_count * sizeof(TNC_VendorID);
this->supported_vids = malloc(size);
int i; size = type_count * sizeof(TNC_MessageSubtype);
this->supported_subtypes = malloc(size);
for (i = 0; i < type_count; i++) for (i = 0; i < type_count; i++)
{ {
written = snprintf(pos, len, " 0x%08x", supported_types[i]); vid = (supported_types[i] >> 8) & TNC_VENDORID_ANY;
subtype = supported_types[i] & TNC_SUBTYPE_ANY;
pa_subtype_names = get_pa_subtype_names(vid);
if (pa_subtype_names)
{
written = snprintf(pos, len," '%N/%N' 0x%06x/0x%02x",
pen_names, vid, pa_subtype_names, subtype,
vid, subtype);
}
else
{
written = snprintf(pos, len," '%N' 0x%06x/0x%02x",
pen_names, vid, vid, subtype);
}
if (written >= len)
{
break;
}
pos += written;
len -= written;
this->supported_vids[i] = vid;
this->supported_subtypes[i] = subtype;
}
}
*pos = '\0';
DBG2(DBG_TNC, "IMV %u supports %u message type%s:%s",
this->id, type_count, (type_count == 1) ? "":"s", buf);
/* unlock the imv_t instance */
this->mutex->unlock(this->mutex);
}
METHOD(imv_t, set_message_types_long, void,
private_tnc_imv_t *this, TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes, TNC_UInt32 type_count)
{
char buf[BUF_LEN];
char *pos = buf;
int len = sizeof(buf);
int i, written;
size_t size;
TNC_VendorID vid;
TNC_MessageSubtype subtype;
enum_name_t *pa_subtype_names;
/* lock the imv_t instance */
this->mutex->lock(this->mutex);
/* Free existing VendorID and MessageSubtype lists */
free(this->supported_vids);
this->supported_vids = NULL;
free(this->supported_subtypes);
this->supported_subtypes = NULL;
/* Store the new MessageType list */
this->type_count = type_count;
if (type_count && supported_vids && supported_subtypes)
{
size = type_count * sizeof(TNC_VendorID);
this->supported_vids = malloc(size);
memcpy(this->supported_vids, supported_vids, size);
size = type_count * sizeof(TNC_MessageSubtype);
this->supported_subtypes = malloc(size);
memcpy(this->supported_subtypes, supported_subtypes, size);
for (i = 0; i < type_count; i++)
{
vid = supported_vids[i];
subtype = supported_subtypes[i];
pa_subtype_names = get_pa_subtype_names(vid);
if (pa_subtype_names)
{
written = snprintf(pos, len," '%N/%N' 0x%06x/0x%08x",
pen_names, vid, pa_subtype_names, subtype,
vid, subtype);
}
else
{
written = snprintf(pos, len," '%N' 0x%06x/0x%08x",
pen_names, vid, vid, subtype);
}
if (written >= len) if (written >= len)
{ {
break; break;
@@ -121,14 +218,12 @@ METHOD(imv_t, set_message_types, void,
pos += written; pos += written;
len -= written; len -= written;
} }
this->supported_types = malloc(size);
memcpy(this->supported_types, supported_types, size);
} }
*pos = '\0'; *pos = '\0';
DBG2(DBG_TNC, "IMV %u supports %u message type%s:%s", DBG2(DBG_TNC, "IMV %u supports %u message type%s:%s",
this->id, type_count, (type_count == 1) ? "":"s", buf); this->id, type_count, (type_count == 1) ? "":"s", buf);
/* lock the imv_t instance */ /* unlock the imv_t instance */
this->mutex->unlock(this->mutex); this->mutex->unlock(this->mutex);
} }
@@ -144,14 +239,12 @@ METHOD(imv_t, type_supported, bool,
for (i = 0; i < this->type_count; i++) for (i = 0; i < this->type_count; i++)
{ {
vid = (this->supported_types[i] >> 8) & TNC_VENDORID_ANY; vid = this->supported_vids[i];
subtype = this->supported_types[i] & TNC_SUBTYPE_ANY; subtype = this->supported_subtypes[i];
if (this->supported_types[i] == message_type if ((vid == TNC_VENDORID_ANY && subtype == TNC_SUBTYPE_ANY) ||
|| (subtype == TNC_SUBTYPE_ANY (vid == msg_vid && (subtype == TNC_SUBTYPE_ANY ||
&& (msg_vid == vid || vid == TNC_VENDORID_ANY)) subtype == msg_subtype)))
|| (vid == TNC_VENDORID_ANY
&& (msg_subtype == subtype || subtype == TNC_SUBTYPE_ANY)))
{ {
return TRUE; return TRUE;
} }
@@ -164,7 +257,8 @@ METHOD(imv_t, destroy, void,
{ {
dlclose(this->handle); dlclose(this->handle);
this->mutex->destroy(this->mutex); this->mutex->destroy(this->mutex);
free(this->supported_types); free(this->supported_vids);
free(this->supported_subtypes);
free(this->name); free(this->name);
free(this->path); free(this->path);
free(this); free(this);
@@ -183,6 +277,7 @@ imv_t* tnc_imv_create(char *name, char *path)
.get_id = _get_id, .get_id = _get_id,
.get_name = _get_name, .get_name = _get_name,
.set_message_types = _set_message_types, .set_message_types = _set_message_types,
.set_message_types_long = _set_message_types_long,
.type_supported = _type_supported, .type_supported = _type_supported,
.destroy = _destroy, .destroy = _destroy,
}, },
@@ -37,6 +37,25 @@ TNC_Result TNC_TNCS_ReportMessageTypes(TNC_IMVID imv_id,
type_count); type_count);
} }
/**
* Called by the IMV to inform a TNCS about the set of message types the IMV
* is able to receive. This function supports long message types.
*/
TNC_Result TNC_TNCS_ReportMessageTypesLong(TNC_IMVID imv_id,
TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes,
TNC_UInt32 type_count)
{
if (!tnc->imvs->is_registered(tnc->imvs, imv_id))
{
DBG1(DBG_TNC, "ignoring ReportMessageTypes() from unregistered IMV %u",
imv_id);
return TNC_RESULT_INVALID_PARAMETER;
}
return tnc->imvs->set_message_types_long(tnc->imvs, imv_id, supported_vids,
supported_subtypes, type_count);
}
/** /**
* Called by the IMV to ask a TNCS to retry an Integrity Check Handshake * Called by the IMV to ask a TNCS to retry an Integrity Check Handshake
*/ */
@@ -144,6 +163,10 @@ TNC_Result TNC_TNCS_BindFunction(TNC_IMVID id,
{ {
*function_pointer = (void*)TNC_TNCS_ReportMessageTypes; *function_pointer = (void*)TNC_TNCS_ReportMessageTypes;
} }
else if (streq(function_name, "TNC_TNCS_ReportMessageTypesLong"))
{
*function_pointer = (void*)TNC_TNCS_ReportMessageTypesLong;
}
else if (streq(function_name, "TNC_TNCS_RequestHandshakeRetry")) else if (streq(function_name, "TNC_TNCS_RequestHandshakeRetry"))
{ {
*function_pointer = (void*)TNC_TNCS_RequestHandshakeRetry; *function_pointer = (void*)TNC_TNCS_RequestHandshakeRetry;
@@ -267,6 +267,31 @@ METHOD(imv_manager_t, set_message_types, TNC_Result,
return result; return result;
} }
METHOD(imv_manager_t, set_message_types_long, TNC_Result,
private_tnc_imv_manager_t *this, TNC_IMVID id,
TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes,
TNC_UInt32 type_count)
{
enumerator_t *enumerator;
imv_t *imv;
TNC_Result result = TNC_RESULT_FATAL;
enumerator = this->imvs->create_enumerator(this->imvs);
while (enumerator->enumerate(enumerator, &imv))
{
if (id == imv->get_id(imv))
{
imv->set_message_types_long(imv, supported_vids, supported_subtypes,
type_count);
result = TNC_RESULT_SUCCESS;
break;
}
}
enumerator->destroy(enumerator);
return result;
}
METHOD(imv_manager_t, solicit_recommendation, void, METHOD(imv_manager_t, solicit_recommendation, void,
private_tnc_imv_manager_t *this, TNC_ConnectionID id) private_tnc_imv_manager_t *this, TNC_ConnectionID id)
{ {
@@ -364,6 +389,7 @@ imv_manager_t* tnc_imv_manager_create(void)
.enforce_recommendation = _enforce_recommendation, .enforce_recommendation = _enforce_recommendation,
.notify_connection_change = _notify_connection_change, .notify_connection_change = _notify_connection_change,
.set_message_types = _set_message_types, .set_message_types = _set_message_types,
.set_message_types_long = _set_message_types_long,
.solicit_recommendation = _solicit_recommendation, .solicit_recommendation = _solicit_recommendation,
.receive_message = _receive_message, .receive_message = _receive_message,
.batch_ending = _batch_ending, .batch_ending = _batch_ending,
+4 -4
View File
@@ -126,13 +126,13 @@ METHOD(tnccs_t, send_msg, TNC_Result,
pa_subtype_names = get_pa_subtype_names(msg_vendor_id); pa_subtype_names = get_pa_subtype_names(msg_vendor_id);
if (pa_subtype_names) if (pa_subtype_names)
{ {
DBG2(DBG_TNC, "creating PB-PA message type '%N/%N' 0x%06x/0x%02x", DBG2(DBG_TNC, "creating PB-PA message type '%N/%N' 0x%06x/0x%08x",
pen_names, msg_vendor_id, pa_subtype_names, msg_sub_type, pen_names, msg_vendor_id, pa_subtype_names, msg_sub_type,
msg_vendor_id, msg_sub_type); msg_vendor_id, msg_sub_type);
} }
else else
{ {
DBG2(DBG_TNC, "creating PB-PA message type '%N' 0x%06x/0x%02x", DBG2(DBG_TNC, "creating PB-PA message type '%N' 0x%06x/0x%08x",
pen_names, msg_vendor_id, msg_vendor_id, msg_sub_type); pen_names, msg_vendor_id, msg_vendor_id, msg_sub_type);
} }
@@ -181,13 +181,13 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
pa_subtype_names = get_pa_subtype_names(vendor_id); pa_subtype_names = get_pa_subtype_names(vendor_id);
if (pa_subtype_names) if (pa_subtype_names)
{ {
DBG2(DBG_TNC, "handling PB-PA message type '%N/%N' 0x%06x/0x%02x", DBG2(DBG_TNC, "handling PB-PA message type '%N/%N' 0x%06x/0x%08x",
pen_names, vendor_id, pa_subtype_names, subtype, pen_names, vendor_id, pa_subtype_names, subtype,
vendor_id, subtype); vendor_id, subtype);
} }
else else
{ {
DBG2(DBG_TNC, "handling PB-PA message type '%N' 0x%06x/0x%02x", DBG2(DBG_TNC, "handling PB-PA message type '%N' 0x%06x/0x%08x",
pen_names, vendor_id, vendor_id, subtype); pen_names, vendor_id, vendor_id, subtype);
} }
+44 -33
View File
@@ -40,11 +40,11 @@ struct imc_t {
* the API version number to be used. It also supplies the IMC ID, an IMC * the API version number to be used. It also supplies the IMC ID, an IMC
* identifier that the IMC must use when calling TNC Client callback functions. * identifier that the IMC must use when calling TNC Client callback functions.
* *
* @param imcID IMC ID assigned by TNCC * @param imcID IMC ID assigned by TNCC
* @param minVersion minimum API version supported by TNCC * @param minVersion minimum API version supported by TNCC
* @param maxVersion maximum API version supported by TNCC * @param maxVersion maximum API version supported by TNCC
* @param OutActualVersion mutually supported API version number * @param OutActualVersion mutually supported API version number
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*initialize)(TNC_IMCID imcID, TNC_Result (*initialize)(TNC_IMCID imcID,
TNC_Version minVersion, TNC_Version minVersion,
@@ -55,10 +55,10 @@ struct imc_t {
* The TNC Client calls this function to inform the IMC that the state of * The TNC Client calls this function to inform the IMC that the state of
* the network connection identified by connectionID has changed to newState. * the network connection identified by connectionID has changed to newState.
* *
* @param imcID IMC ID assigned by TNCC * @param imcID IMC ID assigned by TNCC
* @param connectionID network connection ID assigned by TNCC * @param connectionID network connection ID assigned by TNCC
* @param newState new network connection state * @param newState new network connection state
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*notify_connection_change)(TNC_IMCID imcID, TNC_Result (*notify_connection_change)(TNC_IMCID imcID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
@@ -68,9 +68,9 @@ struct imc_t {
* The TNC Client calls this function to indicate that an Integrity Check * The TNC Client calls this function to indicate that an Integrity Check
* Handshake is beginning and solicit messages from IMCs for the first batch. * Handshake is beginning and solicit messages from IMCs for the first batch.
* *
* @param imcID IMC ID assigned by TNCC * @param imcID IMC ID assigned by TNCC
* @param connectionID network connection ID assigned by TNCC * @param connectionID network connection ID assigned by TNCC
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*begin_handshake)(TNC_IMCID imcID, TNC_Result (*begin_handshake)(TNC_IMCID imcID,
TNC_ConnectionID connectionID); TNC_ConnectionID connectionID);
@@ -81,12 +81,12 @@ struct imc_t {
* the number of octets indicated by messageLength. The type of the message * the number of octets indicated by messageLength. The type of the message
* is indicated by messageType. * is indicated by messageType.
* *
* @param imcID IMC ID assigned by TNCS * @param imcID IMC ID assigned by TNCS
* @param connectionID network connection ID assigned by TNCC * @param connectionID network connection ID assigned by TNCC
* @param message reference to buffer containing message * @param message reference to buffer containing message
* @param messageLength number of octets in message * @param messageLength number of octets in message
* @param messageType message type of message * @param messageType message type of message
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*receive_message)(TNC_IMCID imcID, TNC_Result (*receive_message)(TNC_IMCID imcID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
@@ -99,9 +99,9 @@ struct imc_t {
* received in a batch have been delivered and this is the IMC’s last chance * received in a batch have been delivered and this is the IMC’s last chance
* to send a message in the batch of IMC messages currently being collected. * to send a message in the batch of IMC messages currently being collected.
* *
* @param imcID IMC ID assigned by TNCC * @param imcID IMC ID assigned by TNCC
* @param connectionID network connection ID assigned by TNCC * @param connectionID network connection ID assigned by TNCC
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*batch_ending)(TNC_IMCID imcID, TNC_Result (*batch_ending)(TNC_IMCID imcID,
TNC_ConnectionID connectionID); TNC_ConnectionID connectionID);
@@ -110,8 +110,8 @@ struct imc_t {
* The TNC Client calls this function to close down the IMC when all work is * The TNC Client calls this function to close down the IMC when all work is
* complete or the IMC reports TNC_RESULT_FATAL. * complete or the IMC reports TNC_RESULT_FATAL.
* *
* @param imcID IMC ID assigned by TNCC * @param imcID IMC ID assigned by TNCC
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*terminate)(TNC_IMCID imcID); TNC_Result (*terminate)(TNC_IMCID imcID);
@@ -122,9 +122,9 @@ struct imc_t {
* TNCS bind function. The IMV can then use the TNCS bind function to obtain * TNCS bind function. The IMV can then use the TNCS bind function to obtain
* pointers to any other TNCS functions. * pointers to any other TNCS functions.
* *
* @param imcID IMC ID assigned by TNCC * @param imcID IMC ID assigned by TNCC
* @param bindFunction pointer to TNC_TNCC_BindFunction * @param bindFunction pointer to TNC_TNCC_BindFunction
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*provide_bind_function)(TNC_IMCID imcID, TNC_Result (*provide_bind_function)(TNC_IMCID imcID,
TNC_TNCC_BindFunctionPointer bindFunction); TNC_TNCC_BindFunctionPointer bindFunction);
@@ -132,38 +132,49 @@ struct imc_t {
/** /**
* Sets the ID of an imc_t object. * Sets the ID of an imc_t object.
* *
* @param id IMC ID to be assigned * @param id IMC ID to be assigned
*/ */
void (*set_id)(imc_t *this, TNC_IMCID id); void (*set_id)(imc_t *this, TNC_IMCID id);
/** /**
* Returns the ID of an imc_t object. * Returns the ID of an imc_t object.
* *
* @return assigned IMC ID * @return assigned IMC ID
*/ */
TNC_IMCID (*get_id)(imc_t *this); TNC_IMCID (*get_id)(imc_t *this);
/** /**
* Returns the name of an imc_t object. * Returns the name of an imc_t object.
* *
* @return name of IMC * @return name of IMC
*/ */
char* (*get_name)(imc_t *this); char* (*get_name)(imc_t *this);
/** /**
* Sets the supported message types of an imc_t object. * Sets the supported message types of an imc_t object.
* *
* @param supported_types list of messages type supported by IMC * @param supported_types list of messages type supported by IMC
* @param type_count number of supported message types * @param type_count number of supported message types
*/ */
void (*set_message_types)(imc_t *this, TNC_MessageTypeList supported_types, void (*set_message_types)(imc_t *this, TNC_MessageTypeList supported_types,
TNC_UInt32 type_count); TNC_UInt32 type_count);
/**
* Sets the supported long message types of an imc_t object.
*
* @param supported_vids list of vendor IDs supported by IMC
* @param supported_subtypes list of messages type supported by IMC
* @param type_count number of supported message types
*/
void (*set_message_types_long)(imc_t *this, TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes,
TNC_UInt32 type_count);
/** /**
* Check if the IMC supports a given message type. * Check if the IMC supports a given message type.
* *
* @param message_type message type * @param message_type message type
* @return TRUE if supported * @return TRUE if supported
*/ */
bool (*type_supported)(imc_t *this, TNC_MessageType message_type); bool (*type_supported)(imc_t *this, TNC_MessageType message_type);
+20 -5
View File
@@ -84,23 +84,38 @@ struct imc_manager_t {
/** /**
* Begin a handshake between the IMCs and a connection * Begin a handshake between the IMCs and a connection
* *
* @param id connection ID * @param id connection ID
*/ */
void (*begin_handshake)(imc_manager_t *this, TNC_ConnectionID id); void (*begin_handshake)(imc_manager_t *this, TNC_ConnectionID id);
/** /**
* Sets the supported message types reported by a given IMC * Sets the supported message types reported by a given IMC
* *
* @param id ID of reporting IMC * @param id ID of reporting IMC
* @param supported_types list of messages type supported by IMC * @param supported_types list of messages type supported by IMC
* @param type_count number of supported message types * @param type_count number of supported message types
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*set_message_types)(imc_manager_t *this, TNC_Result (*set_message_types)(imc_manager_t *this,
TNC_IMCID id, TNC_IMCID id,
TNC_MessageTypeList supported_types, TNC_MessageTypeList supported_types,
TNC_UInt32 type_count); TNC_UInt32 type_count);
/**
* Sets the supported long message types reported by a given IMC
*
* @param id ID of reporting IMC
* @param supported_vids list of vendor IDs supported by IMC
* @param supported_subtypes list of messages type supported by IMC
* @param type_count number of supported message types
* @return TNC result code
*/
TNC_Result (*set_message_types_long)(imc_manager_t *this,
TNC_IMCID id,
TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes,
TNC_UInt32 type_count);
/** /**
* Delivers a message to interested IMCs. * Delivers a message to interested IMCs.
* *
+44 -33
View File
@@ -40,11 +40,11 @@ struct imv_t {
* the API version number to be used. It also supplies the IMV ID, an IMV * the API version number to be used. It also supplies the IMV ID, an IMV
* identifier that the IMV must use when calling TNC Server callback functions. * identifier that the IMV must use when calling TNC Server callback functions.
* *
* @param imvID IMV ID assigned by TNCS * @param imvID IMV ID assigned by TNCS
* @param minVersion minimum API version supported * @param minVersion minimum API version supported
* @param maxVersion maximum API version supported by TNCS * @param maxVersion maximum API version supported by TNCS
* @param OutActualVersion mutually supported API version number * @param OutActualVersion mutually supported API version number
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*initialize)(TNC_IMVID imvID, TNC_Result (*initialize)(TNC_IMVID imvID,
TNC_Version minVersion, TNC_Version minVersion,
@@ -55,10 +55,10 @@ struct imv_t {
* The TNC Server calls this function to inform the IMV that the state of * The TNC Server calls this function to inform the IMV that the state of
* the network connection identified by connectionID has changed to newState. * the network connection identified by connectionID has changed to newState.
* *
* @param imvID IMV ID assigned by TNCS * @param imvID IMV ID assigned by TNCS
* @param connectionID network connection ID assigned by TNCS * @param connectionID network connection ID assigned by TNCS
* @param newState new network connection state * @param newState new network connection state
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*notify_connection_change)(TNC_IMVID imvID, TNC_Result (*notify_connection_change)(TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
@@ -69,9 +69,9 @@ struct imv_t {
* Handshake (after all IMC-IMV messages have been delivered) to solicit * Handshake (after all IMC-IMV messages have been delivered) to solicit
* recommendations from IMVs that have not yet provided a recommendation. * recommendations from IMVs that have not yet provided a recommendation.
* *
* @param imvID IMV ID assigned by TNCS * @param imvID IMV ID assigned by TNCS
* @param connectionID network connection ID assigned by TNCS * @param connectionID network connection ID assigned by TNCS
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*solicit_recommendation)(TNC_IMVID imvID, TNC_Result (*solicit_recommendation)(TNC_IMVID imvID,
TNC_ConnectionID connectionID); TNC_ConnectionID connectionID);
@@ -82,12 +82,12 @@ struct imv_t {
* the number of octets indicated by messageLength. The type of the message * the number of octets indicated by messageLength. The type of the message
* is indicated by messageType. * is indicated by messageType.
* *
* @param imvID IMV ID assigned by TNCS * @param imvID IMV ID assigned by TNCS
* @param connectionID network connection ID assigned by TNCS * @param connectionID network connection ID assigned by TNCS
* @param message reference to buffer containing message * @param message reference to buffer containing message
* @param messageLength number of octets in message * @param messageLength number of octets in message
* @param messageType message type of message * @param messageType message type of message
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*receive_message)(TNC_IMVID imvID, TNC_Result (*receive_message)(TNC_IMVID imvID,
TNC_ConnectionID connectionID, TNC_ConnectionID connectionID,
@@ -100,9 +100,9 @@ struct imv_t {
* received in a batch have been delivered and this is the IMV’s last chance * received in a batch have been delivered and this is the IMV’s last chance
* to send a message in the batch of IMV messages currently being collected. * to send a message in the batch of IMV messages currently being collected.
* *
* @param imvID IMV ID assigned by TNCS * @param imvID IMV ID assigned by TNCS
* @param connectionID network connection ID assigned by TNCS * @param connectionID network connection ID assigned by TNCS
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*batch_ending)(TNC_IMVID imvID, TNC_Result (*batch_ending)(TNC_IMVID imvID,
TNC_ConnectionID connectionID); TNC_ConnectionID connectionID);
@@ -110,8 +110,8 @@ struct imv_t {
/** /**
* The TNC Server calls this function to close down the IMV. * The TNC Server calls this function to close down the IMV.
* *
* @param imvID IMV ID assigned by TNCS * @param imvID IMV ID assigned by TNCS
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*terminate)(TNC_IMVID imvID); TNC_Result (*terminate)(TNC_IMVID imvID);
@@ -122,9 +122,9 @@ struct imv_t {
* TNCS bind function. The IMV can then use the TNCS bind function to obtain * TNCS bind function. The IMV can then use the TNCS bind function to obtain
* pointers to any other TNCS functions. * pointers to any other TNCS functions.
* *
* @param imvID IMV ID assigned by TNCS * @param imvID IMV ID assigned by TNCS
* @param bindFunction pointer to TNC_TNCS_BindFunction * @param bindFunction pointer to TNC_TNCS_BindFunction
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*provide_bind_function)(TNC_IMVID imvID, TNC_Result (*provide_bind_function)(TNC_IMVID imvID,
TNC_TNCS_BindFunctionPointer bindFunction); TNC_TNCS_BindFunctionPointer bindFunction);
@@ -132,38 +132,49 @@ struct imv_t {
/** /**
* Sets the ID of an imv_t object. * Sets the ID of an imv_t object.
* *
* @param id IMV ID to be assigned * @param id IMV ID to be assigned
*/ */
void (*set_id)(imv_t *this, TNC_IMVID id); void (*set_id)(imv_t *this, TNC_IMVID id);
/** /**
* Returns the ID of an imv_t object. * Returns the ID of an imv_t object.
* *
* @return IMV ID assigned by TNCS * @return IMV ID assigned by TNCS
*/ */
TNC_IMVID (*get_id)(imv_t *this); TNC_IMVID (*get_id)(imv_t *this);
/** /**
* Returns the name of an imv_t object. * Returns the name of an imv_t object.
* *
* @return name of IMV * @return name of IMV
*/ */
char* (*get_name)(imv_t *this); char* (*get_name)(imv_t *this);
/** /**
* Sets the supported message types of an imv_t object. * Sets the supported message types of an imv_t object.
* *
* @param supported_types list of messages type supported by IMV * @param supported_types list of messages type supported by IMV
* @param type_count number of supported message types * @param type_count number of supported message types
*/ */
void (*set_message_types)(imv_t *this, TNC_MessageTypeList supported_types, void (*set_message_types)(imv_t *this, TNC_MessageTypeList supported_types,
TNC_UInt32 type_count); TNC_UInt32 type_count);
/**
* Sets the supported long message types of an imv_t object.
*
* @param supported_vids list of vendor IDs supported by IMC
* @param supported_subtypes list of messages type supported by IMC
* @param type_count number of supported message types
*/
void (*set_message_types_long)(imv_t *this, TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes,
TNC_UInt32 type_count);
/** /**
* Check if the IMV supports a given message type. * Check if the IMV supports a given message type.
* *
* @param message_type message type * @param message_type message type
* @return TRUE if supported * @return TRUE if supported
*/ */
bool (*type_supported)(imv_t *this, TNC_MessageType message_type); bool (*type_supported)(imv_t *this, TNC_MessageType message_type);
+20 -5
View File
@@ -106,20 +106,35 @@ struct imv_manager_t {
/** /**
* Sets the supported message types reported by a given IMV * Sets the supported message types reported by a given IMV
* *
* @param id ID of reporting IMV * @param id ID of reporting IMV
* @param supported_types list of messages type supported by IMV * @param supported_types list of messages type supported by IMV
* @param type_count number of supported message types * @param type_count number of supported message types
* @return TNC result code * @return TNC result code
*/ */
TNC_Result (*set_message_types)(imv_manager_t *this, TNC_Result (*set_message_types)(imv_manager_t *this,
TNC_IMVID id, TNC_IMVID id,
TNC_MessageTypeList supported_types, TNC_MessageTypeList supported_types,
TNC_UInt32 type_count); TNC_UInt32 type_count);
/**
* Sets the supported long message types reported by a given IMV
*
* @param id ID of reporting IMV
* @param supported_vids list of vendor IDs supported by IMV
* @param supported_subtypes list of messages type supported by IMV
* @param type_count number of supported message types
* @return TNC result code
*/
TNC_Result (*set_message_types_long)(imv_manager_t *this,
TNC_IMVID id,
TNC_VendorIDList supported_vids,
TNC_MessageSubtypeList supported_subtypes,
TNC_UInt32 type_count);
/** /**
* Solicit recommendations from IMVs that have not yet provided one * Solicit recommendations from IMVs that have not yet provided one
* *
* @param id connection ID * @param id connection ID
*/ */
void (*solicit_recommendation)(imv_manager_t *this, TNC_ConnectionID id); void (*solicit_recommendation)(imv_manager_t *this, TNC_ConnectionID id);