From: Andreas Steffen Date: Mon, 8 Nov 2010 22:13:40 +0000 (+0100) Subject: implemented batch_ending() and solicit_recommendation() functions X-Git-Tag: 4.5.1~543 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d599902a3a99eaf73b039de382bf02d6dc338273;p=thirdparty%2Fstrongswan.git implemented batch_ending() and solicit_recommendation() functions --- diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c index 4f7bd7d4fb..d78c92a259 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c @@ -175,6 +175,23 @@ METHOD(imc_manager_t, receive_message, void, enumerator->destroy(enumerator); } +METHOD(imc_manager_t, batch_ending, void, + private_tnc_imc_manager_t *this, TNC_ConnectionID id) +{ + enumerator_t *enumerator; + imc_t *imc; + + enumerator = this->imcs->create_enumerator(this->imcs); + while (enumerator->enumerate(enumerator, &imc)) + { + if (imc->batch_ending) + { + imc->batch_ending(imc->get_id(imc), id); + } + } + enumerator->destroy(enumerator); +} + METHOD(imc_manager_t, destroy, void, private_tnc_imc_manager_t *this) { @@ -210,6 +227,7 @@ imc_manager_t* tnc_imc_manager_create(void) .begin_handshake = _begin_handshake, .set_message_types = _set_message_types, .receive_message = _receive_message, + .batch_ending = _batch_ending, .destroy = _destroy, }, .imcs = linked_list_create(), diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c b/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c index d46b1f3cca..9e4bc50d7e 100644 --- a/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c +++ b/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c @@ -140,6 +140,20 @@ METHOD(imv_manager_t, set_message_types, TNC_Result, return result; } +METHOD(imv_manager_t, solicit_recommendation, void, + private_tnc_imv_manager_t *this, TNC_ConnectionID id) +{ + enumerator_t *enumerator; + imv_t *imv; + + enumerator = this->imvs->create_enumerator(this->imvs); + while (enumerator->enumerate(enumerator, &imv)) + { + imv->solicit_recommendation(imv->get_id(imv), id); + } + enumerator->destroy(enumerator); +} + METHOD(imv_manager_t, receive_message, void, private_tnc_imv_manager_t *this, TNC_ConnectionID connection_id, TNC_BufferReference message, @@ -161,6 +175,23 @@ METHOD(imv_manager_t, receive_message, void, enumerator->destroy(enumerator); } +METHOD(imv_manager_t, batch_ending, void, + private_tnc_imv_manager_t *this, TNC_ConnectionID id) +{ + enumerator_t *enumerator; + imv_t *imv; + + enumerator = this->imvs->create_enumerator(this->imvs); + while (enumerator->enumerate(enumerator, &imv)) + { + if (imv->batch_ending) + { + imv->batch_ending(imv->get_id(imv), id); + } + } + enumerator->destroy(enumerator); +} + METHOD(imv_manager_t, destroy, void, private_tnc_imv_manager_t *this) { @@ -194,7 +225,9 @@ imv_manager_t* tnc_imv_manager_create(void) .get_count = _get_count, .notify_connection_change = _notify_connection_change, .set_message_types = _set_message_types, + .solicit_recommendation = _solicit_recommendation, .receive_message = _receive_message, + .batch_ending = _batch_ending, .destroy = _destroy, }, .imvs = linked_list_create(), diff --git a/src/libcharon/plugins/tnccs_20/tnccs_20.c b/src/libcharon/plugins/tnccs_20/tnccs_20.c index 128710959f..04bf2a2d02 100644 --- a/src/libcharon/plugins/tnccs_20/tnccs_20.c +++ b/src/libcharon/plugins/tnccs_20/tnccs_20.c @@ -100,11 +100,13 @@ METHOD(tls_t, process, status_t, { charon->imvs->receive_message(charon->imvs, this->connection_id, pos, len, 0x0080ab31); + charon->imvs->batch_ending(charon->imvs, this->connection_id); } else { charon->imcs->receive_message(charon->imcs, this->connection_id, pos, len, 0x0080ab31); + charon->imcs->batch_ending(charon->imcs, this->connection_id); } return NEED_MORE; } diff --git a/src/libcharon/tnc/imc/imc_manager.h b/src/libcharon/tnc/imc/imc_manager.h index 7ce54dafdc..4019937c4d 100644 --- a/src/libcharon/tnc/imc/imc_manager.h +++ b/src/libcharon/tnc/imc/imc_manager.h @@ -67,7 +67,7 @@ struct imc_manager_t { /** * 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); @@ -98,6 +98,15 @@ struct imc_manager_t { TNC_UInt32 message_len, TNC_MessageType message_type); + /** + * Notify all IMCs that all IMV messages received in a batch have been + * delivered and this is the IMCs last chance to send a message in the + * batch of IMC messages currently being collected. + * + * @param id connection ID + */ + void (*batch_ending)(imc_manager_t *this, TNC_ConnectionID id); + /** * Destroy an IMC manager and all its controlled instances. */ diff --git a/src/libcharon/tnc/imv/imv_manager.h b/src/libcharon/tnc/imv/imv_manager.h index fca8d1b0d1..1482361455 100644 --- a/src/libcharon/tnc/imv/imv_manager.h +++ b/src/libcharon/tnc/imv/imv_manager.h @@ -77,6 +77,13 @@ struct imv_manager_t { TNC_MessageTypeList supported_types, TNC_UInt32 type_count); + /** + * Solicit recommendations from IMVs that have not yet provided one + * + * @param id connection ID + */ + void (*solicit_recommendation)(imv_manager_t *this, TNC_ConnectionID id); + /** * Delivers a message to interested IMVs. * @@ -91,6 +98,15 @@ struct imv_manager_t { TNC_UInt32 message_len, TNC_MessageType message_type); + /** + * Notify all IMVs that all IMC messages received in a batch have been + * delivered and this is the IMVs last chance to send a message in the + * batch of IMV messages currently being collected. + * + * @param id connection ID + */ + void (*batch_ending)(imv_manager_t *this, TNC_ConnectionID id); + /** * Destroy an IMV manager and all its controlled instances. */