]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
implemented batch_ending() and solicit_recommendation() functions
authorAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 8 Nov 2010 22:13:40 +0000 (23:13 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 9 Nov 2010 19:43:51 +0000 (20:43 +0100)
src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
src/libcharon/plugins/tnc_imv/tnc_imv_manager.c
src/libcharon/plugins/tnccs_20/tnccs_20.c
src/libcharon/tnc/imc/imc_manager.h
src/libcharon/tnc/imv/imv_manager.h

index 4f7bd7d4fb366f2452fbccda35a555138c615048..d78c92a2594c680f718c16ae20306840c97858c3 100644 (file)
@@ -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(),
index d46b1f3ccaf89a65ae9c39d76379e7a6cda9e64a..9e4bc50d7e12f6ead947e8e4e59b96d17b7a2093 100644 (file)
@@ -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(),
index 128710959fbe8dc25699af6231b38f6cd76d0a18..04bf2a2d02a2be4747faecf8aea30f9b5bdd782f 100644 (file)
@@ -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;
 }
index 7ce54dafdc2b04ac5306350110a3bbc85c28a0b1..4019937c4dff3e1ed094d70e1c200165990cd7b4 100644 (file)
@@ -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.
         */
index fca8d1b0d1a3659b4bb9a76e71347fde3330f59a..1482361455879b6d1baec109d6ff60dc8d6e8af7 100644 (file)
@@ -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.
         */