diff options
Diffstat (limited to 'src/libcharon/plugins/tnc_imc/tnc_imc.c')
-rw-r--r-- | src/libcharon/plugins/tnc_imc/tnc_imc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc.c b/src/libcharon/plugins/tnc_imc/tnc_imc.c index f87853bf9..29f34d939 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc.c @@ -84,6 +84,33 @@ METHOD(imc_t, set_message_types, void, } } +METHOD(imc_t, type_supported, bool, + private_tnc_imc_t *this, TNC_MessageType message_type) +{ + TNC_VendorID msg_vid, vid; + TNC_MessageSubtype msg_subtype, subtype; + int i; + + msg_vid = (message_type >> 8) & TNC_VENDORID_ANY; + msg_subtype = message_type & TNC_SUBTYPE_ANY; + + for (i = 0; i < this->type_count; i++) + { + vid = (this->supported_types[i] >> 8) & TNC_VENDORID_ANY; + subtype = this->supported_types[i] & TNC_SUBTYPE_ANY; + + if (this->supported_types[i] == message_type + || (subtype == TNC_SUBTYPE_ANY + && (msg_vid == vid || vid == TNC_VENDORID_ANY)) + || (vid == TNC_VENDORID_ANY + && (msg_subtype == subtype || subtype == TNC_SUBTYPE_ANY))) + { + return TRUE; + } + } + return FALSE; +} + METHOD(imc_t, destroy, void, private_tnc_imc_t *this) { @@ -106,6 +133,7 @@ imc_t* tnc_imc_create(char* name, char *filename) .get_id = _get_id, .get_name = _get_name, .set_message_types = _set_message_types, + .type_supported = _type_supported, .destroy = _destroy, }, ); |