added get_count() method to IMC/IMV managers
authorAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 8 Nov 2010 21:33:01 +0000 (22:33 +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/tnc/imc/imc_manager.h
src/libcharon/tnc/imv/imv_manager.h

index 5959ab6..4f7bd7d 100644 (file)
@@ -93,6 +93,12 @@ METHOD(imc_manager_t, remove_, imc_t*,
        return NULL;
 }
 
+METHOD(imc_manager_t, get_count, int,
+       private_tnc_imc_manager_t *this)
+{
+       return this->imcs->get_count(this->imcs);
+}
+
 METHOD(imc_manager_t, notify_connection_change, void,
        private_tnc_imc_manager_t *this, TNC_ConnectionID id,
                                                                         TNC_ConnectionState state)
@@ -199,6 +205,7 @@ imc_manager_t* tnc_imc_manager_create(void)
                .public = {
                        .add = _add,
                        .remove = _remove_, /* avoid name conflict with stdio.h */
+                       .get_count = _get_count,
                        .notify_connection_change = _notify_connection_change,
                        .begin_handshake = _begin_handshake,
                        .set_message_types = _set_message_types,
index 2b00020..d46b1f3 100644 (file)
@@ -93,6 +93,12 @@ METHOD(imv_manager_t, remove_, imv_t*,
        return NULL;
 }
 
+METHOD(imv_manager_t, get_count, int,
+       private_tnc_imv_manager_t *this)
+{
+       return this->imvs->get_count(this->imvs);
+}
+
 METHOD(imv_manager_t, notify_connection_change, void,
        private_tnc_imv_manager_t *this, TNC_ConnectionID id,
                                                                         TNC_ConnectionState state)
@@ -185,6 +191,7 @@ imv_manager_t* tnc_imv_manager_create(void)
                .public = {
                        .add = _add,
                        .remove = _remove_, /* avoid name conflict with stdio.h */
+                       .get_count = _get_count,
                        .notify_connection_change = _notify_connection_change,
                        .set_message_types = _set_message_types,
                        .receive_message = _receive_message,
index 169259f..7ce54da 100644 (file)
@@ -49,6 +49,13 @@ struct imc_manager_t {
        imc_t* (*remove)(imc_manager_t *this, TNC_IMCID id);
 
        /**
+        * Return the number of registered IMCs
+        *
+        * @return                                      number of IMCs
+        */
+       int (*get_count)(imc_manager_t *this);
+
+       /**
         * Notify all IMC instances
         *
         * @param state                 communicate the state a connection has reached
index c7b21d1..fca8d1b 100644 (file)
@@ -49,6 +49,13 @@ struct imv_manager_t {
        imv_t* (*remove)(imv_manager_t *this, TNC_IMVID id);
 
        /**
+        * Return the number of registered IMVs
+        *
+        * @return                                      number of IMVs
+        */
+       int (*get_count)(imv_manager_t *this);
+
+       /**
         * Notify all IMV instances
         *
         * @param state                 communicate the state a connection has reached