diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2010-11-08 15:53:50 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2010-11-09 20:43:51 +0100 |
commit | 1dc7b22c537115e85de4683f83970146b10b9242 (patch) | |
tree | a8290b714ab6c2a260f8f3ef7de925865787b348 /src/libcharon/plugins/tnc_imc | |
parent | bcd386a95fda77ad3c07be41896155d6c8ebec74 (diff) | |
download | strongswan-1dc7b22c537115e85de4683f83970146b10b9242.tar.bz2 strongswan-1dc7b22c537115e85de4683f83970146b10b9242.tar.xz |
added imc/imv_manager remove method
Diffstat (limited to 'src/libcharon/plugins/tnc_imc')
-rw-r--r-- | src/libcharon/plugins/tnc_imc/tnc_imc_manager.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c index da10274f1..bc1147ad8 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c @@ -67,12 +67,31 @@ METHOD(imc_manager_t, add, bool, { DBG1(DBG_TNC, "could not provide bind function for IMC '%s'", imc->get_name(imc)); + this->imcs->remove_last(this->imcs, (void**)&imc); return FALSE; } return TRUE; } +METHOD(imc_manager_t, remove_, imc_t*, + private_tnc_imc_manager_t *this, TNC_IMCID id) +{ + enumerator_t *enumerator; + imc_t *imc; + + enumerator = this->imcs->create_enumerator(this->imcs); + while (enumerator->enumerate(enumerator, &imc)) + { + if (id == imc->get_id(imc)) + { + this->imcs->remove_at(this->imcs, enumerator); + return imc; + } + } + enumerator->destroy(enumerator); +} + METHOD(imc_manager_t, notify_connection_change, void, private_tnc_imc_manager_t *this, TNC_ConnectionID id, TNC_ConnectionState state) @@ -178,6 +197,7 @@ imc_manager_t* tnc_imc_manager_create(void) INIT(this, .public = { .add = _add, + .remove = _remove_, /* avoid name conflict with stdio.h */ .notify_connection_change = _notify_connection_change, .begin_handshake = _begin_handshake, .set_message_types = _set_message_types, |