diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2010-11-07 01:17:21 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2010-11-09 20:43:50 +0100 |
commit | e6b6fc881f70211a1510cf2a23230b6fc546e59c (patch) | |
tree | b34f098383803062b3de65ad4f5facd25f86ceab /src/libcharon/plugins/tnc_imc/tnc_imc.c | |
parent | 296636252b514846bd3ec83fbeff6fe40c301745 (diff) | |
download | strongswan-e6b6fc881f70211a1510cf2a23230b6fc546e59c.tar.bz2 strongswan-e6b6fc881f70211a1510cf2a23230b6fc546e59c.tar.xz |
implemented receive_message() function
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, }, ); |