]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
attributes: Move the configuration attributes framework to libcharon
authorMartin Willi <martin@revosec.ch>
Tue, 4 Nov 2014 13:45:34 +0000 (14:45 +0100)
committerMartin Willi <martin@revosec.ch>
Fri, 20 Feb 2015 12:34:55 +0000 (13:34 +0100)
40 files changed:
src/charon-nm/nm/nm_backend.c
src/frontends/android/jni/libandroidbridge/charonservice.c
src/libcharon/Android.mk
src/libcharon/Makefile.am
src/libcharon/attributes/attribute_handler.h [moved from src/libhydra/attributes/attribute_handler.h with 100% similarity]
src/libcharon/attributes/attribute_manager.c [moved from src/libhydra/attributes/attribute_manager.c with 99% similarity]
src/libcharon/attributes/attribute_manager.h [moved from src/libhydra/attributes/attribute_manager.h with 100% similarity]
src/libcharon/attributes/attribute_provider.h [moved from src/libhydra/attributes/attribute_provider.h with 100% similarity]
src/libcharon/attributes/attributes.c [moved from src/libhydra/attributes/attributes.c with 100% similarity]
src/libcharon/attributes/attributes.h [moved from src/libhydra/attributes/attributes.h with 100% similarity]
src/libcharon/attributes/mem_pool.c [moved from src/libhydra/attributes/mem_pool.c with 100% similarity]
src/libcharon/attributes/mem_pool.h [moved from src/libhydra/attributes/mem_pool.h with 100% similarity]
src/libcharon/daemon.c
src/libcharon/daemon.h
src/libcharon/plugins/android_dns/android_dns_plugin.c
src/libcharon/plugins/attr/attr_plugin.c
src/libcharon/plugins/attr/attr_provider.c
src/libcharon/plugins/attr_sql/attr_sql_plugin.c
src/libcharon/plugins/dhcp/dhcp_plugin.c
src/libcharon/plugins/eap_radius/eap_radius_plugin.c
src/libcharon/plugins/ha/ha_plugin.c
src/libcharon/plugins/osx_attr/osx_attr_plugin.c
src/libcharon/plugins/resolve/resolve_plugin.c
src/libcharon/plugins/stroke/stroke_socket.c
src/libcharon/plugins/unit_tester/tests/test_pool.c
src/libcharon/plugins/unity/unity_plugin.c
src/libcharon/plugins/updown/updown_plugin.c
src/libcharon/plugins/vici/vici_plugin.c
src/libcharon/sa/ike_sa.c
src/libcharon/sa/ikev1/tasks/mode_config.c
src/libcharon/sa/ikev2/tasks/ike_config.c
src/libcharon/tests/Makefile.am
src/libcharon/tests/libcharon_tests.h
src/libcharon/tests/suites/test_mem_pool.c [moved from src/libhydra/tests/suites/test_mem_pool.c with 100% similarity]
src/libhydra/Android.mk
src/libhydra/Makefile.am
src/libhydra/hydra.c
src/libhydra/hydra.h
src/libhydra/tests/Makefile.am
src/libhydra/tests/hydra_tests.h

index 613c2f6b5749466c02989944ff35fbe53265df8d..601daca0a3dbe75fb4973a21cacae790da0a6d4f 100644 (file)
@@ -18,7 +18,6 @@
 #include "nm_creds.h"
 #include "nm_handler.h"
 
-#include <hydra.h>
 #include <daemon.h>
 #include <processing/jobs/callback_job.h>
 
@@ -97,7 +96,8 @@ static void nm_backend_deinit()
                g_object_unref(this->plugin);
        }
        lib->credmgr->remove_set(lib->credmgr, &this->creds->set);
-       hydra->attributes->remove_handler(hydra->attributes, &this->handler->handler);
+       charon->attributes->remove_handler(charon->attributes,
+                                                                          &this->handler->handler);
        this->creds->destroy(this->creds);
        this->handler->destroy(this->handler);
        free(this);
@@ -130,7 +130,7 @@ static bool nm_backend_init()
        this->plugin = nm_strongswan_plugin_new(this->creds, this->handler);
        nm_backend = this;
 
-       hydra->attributes->add_handler(hydra->attributes, &this->handler->handler);
+       charon->attributes->add_handler(charon->attributes, &this->handler->handler);
        lib->credmgr->add_set(lib->credmgr, &this->creds->set);
        if (!this->plugin)
        {
index b83d8278a93753b8792f56a69fda4a8e0dfde013..5246300240b6fc56a65a05dd21d25ea7620f74da 100644 (file)
@@ -425,15 +425,15 @@ static bool charonservice_register(plugin_t *plugin, plugin_feature_t *feature,
        {
                this->net_handler = android_net_create();
                lib->credmgr->add_set(lib->credmgr, &this->creds->set);
-               hydra->attributes->add_handler(hydra->attributes,
-                                                                          &this->attr->handler);
+               charon->attributes->add_handler(charon->attributes,
+                                                                               &this->attr->handler);
        }
        else
        {
                this->net_handler->destroy(this->net_handler);
                lib->credmgr->remove_set(lib->credmgr, &this->creds->set);
-               hydra->attributes->remove_handler(hydra->attributes,
-                                                                                 &this->attr->handler);
+               charon->attributes->remove_handler(charon->attributes,
+                                                                                  &this->attr->handler);
                if (this->service)
                {
                        this->service->destroy(this->service);
index ab71d401621f46d5bab612f6d2d98e1d7160729a..cf4ed3d495b39e6811a8e6a42581c05bea3b3847 100644 (file)
@@ -3,6 +3,10 @@ include $(CLEAR_VARS)
 
 # copy-n-paste from Makefile.am
 libcharon_la_SOURCES := \
+attributes/attributes.c attributes/attributes.h \
+attributes/attribute_provider.h attributes/attribute_handler.h \
+attributes/attribute_manager.c attributes/attribute_manager.h \
+attributes/mem_pool.c attributes/mem_pool.h \
 bus/bus.c bus/bus.h \
 bus/listeners/listener.h \
 bus/listeners/logger.h \
index 7b9a775f4e12f8fa5e43d2713ef4dbc495964c7b..e8500dd9f27acc2e7df48b3bd4e5e8b54e3d2a03 100644 (file)
@@ -1,6 +1,10 @@
 ipseclib_LTLIBRARIES = libcharon.la
 
 libcharon_la_SOURCES = \
+attributes/attributes.c attributes/attributes.h \
+attributes/attribute_provider.h attributes/attribute_handler.h \
+attributes/attribute_manager.c attributes/attribute_manager.h \
+attributes/mem_pool.c attributes/mem_pool.h \
 bus/bus.c bus/bus.h \
 bus/listeners/listener.h \
 bus/listeners/logger.h \
similarity index 99%
rename from src/libhydra/attributes/attribute_manager.c
rename to src/libcharon/attributes/attribute_manager.c
index 5fda8b4268c520a11491a955732d893c381e87a8..d166663fc34846ae987e21d7f0d5b8feff608dbc 100644 (file)
@@ -345,4 +345,3 @@ attribute_manager_t *attribute_manager_create()
 
        return &this->public;
 }
-
index f3859f9123a7fd25cb56c7e6e2635ed7ea907239..d44cb37eba0e355b23e520e4edb927f5ee124a89 100644 (file)
@@ -477,6 +477,7 @@ static void destroy(private_daemon_t *this)
        /* make sure the cache is clear before unloading plugins */
        lib->credmgr->flush_cache(lib->credmgr, CERT_ANY);
        lib->plugins->unload(lib->plugins);
+       DESTROY_IF(this->public.attributes);
        DESTROY_IF(this->kernel_handler);
        DESTROY_IF(this->public.traps);
        DESTROY_IF(this->public.shunts);
@@ -644,6 +645,7 @@ private_daemon_t *daemon_create()
                .ref = 1,
        );
        charon = &this->public;
+       this->public.attributes = attribute_manager_create();
        this->public.controller = controller_create();
        this->public.eap = eap_manager_create();
        this->public.xauth = xauth_manager_create();
index 8ec1ec25308b0e9d051cdebf68485b3f71597f8c..d16bf1ddbcceba2798db05fd1a55026c806566e4 100644 (file)
@@ -19,6 +19,9 @@
 /**
  * @defgroup libcharon libcharon
  *
+ * @defgroup attributes attributes
+ * @ingroup libcharon
+ *
  * @defgroup bus bus
  * @ingroup libcharon
  *
 
 typedef struct daemon_t daemon_t;
 
+#include <attributes/attribute_manager.h>
 #include <network/sender.h>
 #include <network/receiver.h>
 #include <network/socket_manager.h>
@@ -245,6 +249,11 @@ struct daemon_t {
         */
        receiver_t *receiver;
 
+       /**
+        * Manager for IKE configuration attributes
+        */
+       attribute_manager_t *attributes;
+
        /**
         * The signaling bus.
         */
index b8eb11b57b47e1d972998668c67fe8c88911d642..9b6ec0dbab818eb7e31a89fc32a95cd2ee23eda8 100644 (file)
@@ -16,7 +16,6 @@
 #include "android_dns_plugin.h"
 #include "android_dns_handler.h"
 
-#include <hydra.h>
 #include <daemon.h>
 
 typedef struct private_android_dns_plugin_t private_android_dns_plugin_t;
@@ -51,13 +50,13 @@ static bool plugin_cb(private_android_dns_plugin_t *this,
 {
        if (reg)
        {
-               hydra->attributes->add_handler(hydra->attributes,
-                                                                          &this->handler->handler);
+               charon->attributes->add_handler(charon->attributes,
+                                                                               &this->handler->handler);
        }
        else
        {
-               hydra->attributes->remove_handler(hydra->attributes,
-                                                                                 &this->handler->handler);
+               charon->attributes->remove_handler(charon->attributes,
+                                                                                  &this->handler->handler);
        }
        return TRUE;
 }
index 72fcd6dff15c6b413ab2570a6e885c580a952a24..9b15c3cc9d19b5218c5222a2b2a762dd45763069 100644 (file)
@@ -16,7 +16,7 @@
 #include "attr_plugin.h"
 #include "attr_provider.h"
 
-#include <hydra.h>
+#include <daemon.h>
 
 typedef struct private_attr_plugin_t private_attr_plugin_t;
 
@@ -50,13 +50,13 @@ static bool plugin_cb(private_attr_plugin_t *this,
 {
        if (reg)
        {
-               hydra->attributes->add_provider(hydra->attributes,
-                                                                               &this->provider->provider);
+               charon->attributes->add_provider(charon->attributes,
+                                                                                &this->provider->provider);
        }
        else
        {
-               hydra->attributes->remove_provider(hydra->attributes,
-                                                                                  &this->provider->provider);
+               charon->attributes->remove_provider(charon->attributes,
+                                                                                   &this->provider->provider);
        }
        return TRUE;
 }
index c1788df94e4e72c0656c4b7239f0258f383114be..8a768c5b210d34c6650d3db7b918e9b78830b28a 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <time.h>
 
-#include <hydra.h>
+#include <daemon.h>
 #include <utils/debug.h>
 #include <collections/linked_list.h>
 #include <threading/rwlock.h>
index dde90051a1b5d2ed19324661d753bbd31389383e..247cc11c3206991abc762f3a36aa4a364af78f20 100644 (file)
@@ -14,7 +14,7 @@
  * for more details.
  */
 
-#include <hydra.h>
+#include <daemon.h>
 #include <utils/debug.h>
 #include <plugins/plugin_feature.h>
 
@@ -75,13 +75,13 @@ static bool open_database(private_attr_sql_plugin_t *this,
                        return FALSE;
                }
                this->attribute = sql_attribute_create(this->db);
-               hydra->attributes->add_provider(hydra->attributes,
-                                                                               &this->attribute->provider);
+               charon->attributes->add_provider(charon->attributes,
+                                                                                &this->attribute->provider);
        }
        else
        {
-               hydra->attributes->remove_provider(hydra->attributes,
-                                                                                  &this->attribute->provider);
+               charon->attributes->remove_provider(charon->attributes,
+                                                                                       &this->attribute->provider);
                this->attribute->destroy(this->attribute);
                this->db->destroy(this->db);
        }
index c36c60d28c6b4e5e51e3f9f7b6611141d325bc23..642e28afc8962228d3c55581a904e30ee9e5db8f 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "dhcp_plugin.h"
 
-#include <hydra.h>
 #include <daemon.h>
 #include <plugins/plugin_feature.h>
 
@@ -69,13 +68,13 @@ static bool plugin_cb(private_dhcp_plugin_t *this,
                        return FALSE;
                }
                this->provider = dhcp_provider_create(this->socket);
-               hydra->attributes->add_provider(hydra->attributes,
-                                                                               &this->provider->provider);
+               charon->attributes->add_provider(charon->attributes,
+                                                                                &this->provider->provider);
        }
        else
        {
-               hydra->attributes->remove_provider(hydra->attributes,
-                                                                                  &this->provider->provider);
+               charon->attributes->remove_provider(charon->attributes,
+                                                                                       &this->provider->provider);
                this->provider->destroy(this->provider);
                this->socket->destroy(this->socket);
        }
index 5d3540861ce0ad53c1d3f06d9599bda4669a0160..6a4a0384eba432ba0c5b261432c0a3f0decbbee6 100644 (file)
@@ -26,7 +26,7 @@
 #include <radius_client.h>
 #include <radius_config.h>
 
-#include <hydra.h>
+#include <daemon.h>
 #include <threading/rwlock.h>
 #include <processing/jobs/callback_job.h>
 #include <processing/jobs/delete_ike_sa_job.h>
@@ -218,13 +218,13 @@ static bool plugin_cb(private_eap_radius_plugin_t *this,
                {
                        charon->bus->add_listener(charon->bus, &this->forward->listener);
                }
-               hydra->attributes->add_provider(hydra->attributes,
-                                                                               &this->provider->provider);
+               charon->attributes->add_provider(charon->attributes,
+                                                                                &this->provider->provider);
        }
        else
        {
-               hydra->attributes->remove_provider(hydra->attributes,
-                                                                                  &this->provider->provider);
+               charon->attributes->remove_provider(charon->attributes,
+                                                                                       &this->provider->provider);
                if (this->forward)
                {
                        charon->bus->remove_listener(charon->bus, &this->forward->listener);
index 493cad5ecabde69caf8c08633d63843249f51da5..a58377babbbdfc2272defd7dad42b8ff5a52ba68 100644 (file)
@@ -25,7 +25,6 @@
 #include "ha_attribute.h"
 
 #include <daemon.h>
-#include <hydra.h>
 #include <config/child_cfg.h>
 
 typedef struct private_ha_plugin_t private_ha_plugin_t;
@@ -108,13 +107,13 @@ static bool plugin_cb(private_ha_plugin_t *this,
                charon->bus->add_listener(charon->bus, &this->segments->listener);
                charon->bus->add_listener(charon->bus, &this->ike->listener);
                charon->bus->add_listener(charon->bus, &this->child->listener);
-               hydra->attributes->add_provider(hydra->attributes,
-                                                                               &this->attr->provider);
+               charon->attributes->add_provider(charon->attributes,
+                                                                                &this->attr->provider);
        }
        else
        {
-               hydra->attributes->remove_provider(hydra->attributes,
-                                                                                  &this->attr->provider);
+               charon->attributes->remove_provider(charon->attributes,
+                                                                                       &this->attr->provider);
                charon->bus->remove_listener(charon->bus, &this->segments->listener);
                charon->bus->remove_listener(charon->bus, &this->ike->listener);
                charon->bus->remove_listener(charon->bus, &this->child->listener);
@@ -224,4 +223,3 @@ plugin_t *ha_plugin_create()
 
        return &this->public.plugin;
 }
-
index 380483c23e98ccc9755987f69f1aec924c553c8f..4be9eda5e4754ded0fac730ae2e05a4df53ea67e 100644 (file)
@@ -16,7 +16,6 @@
 #include "osx_attr_plugin.h"
 #include "osx_attr_handler.h"
 
-#include <hydra.h>
 #include <daemon.h>
 
 typedef struct private_osx_attr_plugin_t private_osx_attr_plugin_t;
@@ -51,13 +50,13 @@ static bool plugin_cb(private_osx_attr_plugin_t *this,
 {
        if (reg)
        {
-               hydra->attributes->add_handler(hydra->attributes,
-                                                                          &this->handler->handler);
+               charon->attributes->add_handler(charon->attributes,
+                                                                               &this->handler->handler);
        }
        else
        {
-               hydra->attributes->remove_handler(hydra->attributes,
-                                                                                 &this->handler->handler);
+               charon->attributes->remove_handler(charon->attributes,
+                                                                                  &this->handler->handler);
        }
        return TRUE;
 }
index 00c025f13cc7b367b671abebf8274b0a4e3e006e..193c5b602a6e2378173b6d1912ec207413516b49 100644 (file)
@@ -16,7 +16,7 @@
 #include "resolve_plugin.h"
 #include "resolve_handler.h"
 
-#include <hydra.h>
+#include <daemon.h>
 
 typedef struct private_resolve_plugin_t private_resolve_plugin_t;
 
@@ -50,13 +50,13 @@ static bool plugin_cb(private_resolve_plugin_t *this,
 {
        if (reg)
        {
-               hydra->attributes->add_handler(hydra->attributes,
-                                                                          &this->handler->handler);
+               charon->attributes->add_handler(charon->attributes,
+                                                                               &this->handler->handler);
        }
        else
        {
-               hydra->attributes->remove_handler(hydra->attributes,
-                                                                                 &this->handler->handler);
+               charon->attributes->remove_handler(charon->attributes,
+                                                                                  &this->handler->handler);
        }
        return TRUE;
 }
index 54dd56e9144e41ea77c58f6b5e60b98fa3842b65..db7e66f14373a6af65d2d800da946f946a74181c 100644 (file)
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include <hydra.h>
 #include <daemon.h>
 
 #include "stroke_config.h"
@@ -747,8 +746,10 @@ METHOD(stroke_socket_t, destroy, void,
        lib->credmgr->remove_set(lib->credmgr, &this->ca->set);
        lib->credmgr->remove_set(lib->credmgr, &this->cred->set);
        charon->backends->remove_backend(charon->backends, &this->config->backend);
-       hydra->attributes->remove_provider(hydra->attributes, &this->attribute->provider);
-       hydra->attributes->remove_handler(hydra->attributes, &this->handler->handler);
+       charon->attributes->remove_provider(charon->attributes,
+                                                                               &this->attribute->provider);
+       charon->attributes->remove_handler(charon->attributes,
+                                                                          &this->handler->handler);
        charon->bus->remove_listener(charon->bus, &this->counter->listener);
        this->cred->destroy(this->cred);
        this->ca->destroy(this->ca);
@@ -790,8 +791,10 @@ stroke_socket_t *stroke_socket_create()
        lib->credmgr->add_set(lib->credmgr, &this->ca->set);
        lib->credmgr->add_set(lib->credmgr, &this->cred->set);
        charon->backends->add_backend(charon->backends, &this->config->backend);
-       hydra->attributes->add_provider(hydra->attributes, &this->attribute->provider);
-       hydra->attributes->add_handler(hydra->attributes, &this->handler->handler);
+       charon->attributes->add_provider(charon->attributes,
+                                                                        &this->attribute->provider);
+       charon->attributes->add_handler(charon->attributes,
+                                                                       &this->handler->handler);
        charon->bus->add_listener(charon->bus, &this->counter->listener);
 
        max_concurrent = lib->settings->get_int(lib->settings,
index f36953f3a95ff0d80b4375d5f259dac2e46289e3..da5c22f62b99271e26e8b885c49112ed27968a34 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <library.h>
 #include <threading/thread.h>
-#include <hydra.h>
+#include <daemon.h>
 
 #define ALLOCS 1000
 #define THREADS 20
@@ -44,8 +44,8 @@ static void* testing(void *thread)
        /* allocate addresses */
        for (i = 0; i < ALLOCS; i++)
        {
-               addr[i] = hydra->attributes->acquire_address(hydra->attributes,
-                                                                                                        pools, id[i], NULL);
+               addr[i] = charon->attributes->acquire_address(charon->attributes,
+                                                                                                         pools, id[i], NULL);
                if (!addr[i])
                {
                        pools->destroy(pools);
@@ -56,8 +56,8 @@ static void* testing(void *thread)
        /* release addresses */
        for (i = 0; i < ALLOCS; i++)
        {
-               hydra->attributes->release_address(hydra->attributes,
-                                                                                  pools, addr[i], id[i]);
+               charon->attributes->release_address(charon->attributes,
+                                                                                       pools, addr[i], id[i]);
        }
 
        pools->destroy(pools);
@@ -97,4 +97,3 @@ bool test_pool()
        }
        return TRUE;
 }
-
index 9e4571d34646288b33ecb4a77f1416087a55c384..b7a3fee2e7c06b18c23b7398a48c92122e521aab 100644 (file)
@@ -19,7 +19,6 @@
 #include "unity_provider.h"
 
 #include <daemon.h>
-#include <hydra.h>
 
 typedef struct private_unity_plugin_t private_unity_plugin_t;
 
@@ -63,19 +62,19 @@ static bool plugin_cb(private_unity_plugin_t *this,
 {
        if (reg)
        {
-               hydra->attributes->add_handler(hydra->attributes,
-                                                                          &this->handler->handler);
-               hydra->attributes->add_provider(hydra->attributes,
-                                                                               &this->provider->provider);
+               charon->attributes->add_handler(charon->attributes,
+                                                                               &this->handler->handler);
+               charon->attributes->add_provider(charon->attributes,
+                                                                                &this->provider->provider);
                charon->bus->add_listener(charon->bus, &this->narrower->listener);
        }
        else
        {
                charon->bus->remove_listener(charon->bus, &this->narrower->listener);
-               hydra->attributes->remove_handler(hydra->attributes,
-                                                                                 &this->handler->handler);
-               hydra->attributes->remove_provider(hydra->attributes,
-                                                                                  &this->provider->provider);
+               charon->attributes->remove_handler(charon->attributes,
+                                                                                  &this->handler->handler);
+               charon->attributes->remove_provider(charon->attributes,
+                                                                                       &this->provider->provider);
 
        }
        return TRUE;
index d30267dee1a58c8aef718268c54ebea982bee56c..60ecfcce65fb98945bfa8f70d94a6bf14e34e8a1 100644 (file)
@@ -18,7 +18,6 @@
 #include "updown_handler.h"
 
 #include <daemon.h>
-#include <hydra.h>
 
 typedef struct private_updown_plugin_t private_updown_plugin_t;
 
@@ -61,8 +60,8 @@ static bool plugin_cb(private_updown_plugin_t *this,
                                                        "%s.plugins.updown.dns_handler", FALSE, lib->ns))
                {
                        this->handler = updown_handler_create();
-                       hydra->attributes->add_handler(hydra->attributes,
-                                                                                  &this->handler->handler);
+                       charon->attributes->add_handler(charon->attributes,
+                                                                                       &this->handler->handler);
                }
                this->listener = updown_listener_create(this->handler);
                charon->bus->add_listener(charon->bus, &this->listener->listener);
@@ -74,8 +73,8 @@ static bool plugin_cb(private_updown_plugin_t *this,
                if (this->handler)
                {
                        this->handler->destroy(this->handler);
-                       hydra->attributes->remove_handler(hydra->attributes,
-                                                                                         &this->handler->handler);
+                       charon->attributes->remove_handler(charon->attributes,
+                                                                                          &this->handler->handler);
                }
        }
        return TRUE;
index 8881feca9042ef2bcabf795275e62cbca9194c2c..af8bd283b4407a8bcc0ed2f83554c450c1e610e7 100644 (file)
@@ -23,7 +23,6 @@
 #include "vici_logger.h"
 
 #include <library.h>
-#include <hydra.h>
 #include <daemon.h>
 
 typedef struct private_vici_plugin_t private_vici_plugin_t;
@@ -104,8 +103,8 @@ static bool register_vici(private_vici_plugin_t *this,
 
                        charon->backends->add_backend(charon->backends,
                                                                                  &this->config->backend);
-                       hydra->attributes->add_provider(hydra->attributes,
-                                                                                       &this->attrs->provider);
+                       charon->attributes->add_provider(charon->attributes,
+                                                                                        &this->attrs->provider);
                        charon->bus->add_logger(charon->bus, &this->logger->logger);
                        return TRUE;
                }
@@ -114,8 +113,8 @@ static bool register_vici(private_vici_plugin_t *this,
        else
        {
                charon->bus->remove_logger(charon->bus, &this->logger->logger);
-               hydra->attributes->remove_provider(hydra->attributes,
-                                                                                  &this->attrs->provider);
+               charon->attributes->remove_provider(charon->attributes,
+                                                                                       &this->attrs->provider);
                charon->backends->remove_backend(charon->backends,
                                                                                 &this->config->backend);
 
index 54f22e61e25ea37b2b9a9cde39548c83ba4ddcf0..6392c1998469e4948c879375cfbb807ba99498c1 100644 (file)
@@ -2346,8 +2346,8 @@ METHOD(ike_sa_t, destroy, void,
        {
                if (entry.handler)
                {
-                       hydra->attributes->release(hydra->attributes, entry.handler,
-                                                                          this->other_id, entry.type, entry.data);
+                       charon->attributes->release(charon->attributes, entry.handler,
+                                                                               this->other_id, entry.type, entry.data);
                }
                free(entry.data.ptr);
        }
@@ -2377,7 +2377,8 @@ METHOD(ike_sa_t, destroy, void,
                        id = get_other_eap_id(this);
                        pools = linked_list_create_from_enumerator(
                                                this->peer_cfg->create_pool_enumerator(this->peer_cfg));
-                       hydra->attributes->release_address(hydra->attributes, pools, vip, id);
+                       charon->attributes->release_address(charon->attributes,
+                                                                                               pools, vip, id);
                        pools->destroy(pools);
                }
                vip->destroy(vip);
index 94026b9af34361d469f65b4ab1e8805bcca0b6ee..66ae69543c5b5548fa971338a53f1799d4cc54d0 100644 (file)
@@ -16,7 +16,6 @@
 #include "mode_config.h"
 
 #include <daemon.h>
-#include <hydra.h>
 #include <encoding/payloads/cp_payload.h>
 
 typedef struct private_mode_config_t private_mode_config_t;
@@ -136,7 +135,7 @@ static void handle_attribute(private_mode_config_t *this,
        enumerator->destroy(enumerator);
 
        /* and pass it to the handle function */
-       handler = hydra->attributes->handle(hydra->attributes,
+       handler = charon->attributes->handle(charon->attributes,
                                                        this->ike_sa->get_other_id(this->ike_sa), handler,
                                                        ca->get_type(ca), ca->get_chunk(ca));
        this->ike_sa->add_configuration_attribute(this->ike_sa,
@@ -326,8 +325,8 @@ static status_t build_request(private_mode_config_t *this, message_t *message)
                enumerator->destroy(enumerator);
        }
 
-       enumerator = hydra->attributes->create_initiator_enumerator(
-                                                               hydra->attributes,
+       enumerator = charon->attributes->create_initiator_enumerator(
+                                                               charon->attributes,
                                                                this->ike_sa->get_other_id(this->ike_sa), vips);
        while (enumerator->enumerate(enumerator, &handler, &type, &data))
        {
@@ -372,12 +371,12 @@ static status_t build_set(private_mode_config_t *this, message_t *message)
        {
                pools = linked_list_create_with_items(name, NULL);
                /* try IPv4, then IPv6 */
-               found = hydra->attributes->acquire_address(hydra->attributes,
-                                                                                                  pools, id, any4);
+               found = charon->attributes->acquire_address(charon->attributes,
+                                                                                                       pools, id, any4);
                if (!found)
                {
-                       found = hydra->attributes->acquire_address(hydra->attributes,
-                                                                                                          pools, id, any6);
+                       found = charon->attributes->acquire_address(charon->attributes,
+                                                                                                               pools, id, any6);
                }
                pools->destroy(pools);
                if (found)
@@ -398,8 +397,8 @@ static status_t build_set(private_mode_config_t *this, message_t *message)
        /* query registered providers for additional attributes to include */
        pools = linked_list_create_from_enumerator(
                                                                        config->create_pool_enumerator(config));
-       enumerator = hydra->attributes->create_responder_enumerator(
-                                                                       hydra->attributes, pools, id, this->vips);
+       enumerator = charon->attributes->create_responder_enumerator(
+                                                                       charon->attributes, pools, id, this->vips);
        while (enumerator->enumerate(enumerator, &type, &value))
        {
                add_attribute(this, cp, type, value, NULL);
@@ -489,8 +488,8 @@ static status_t build_reply(private_mode_config_t *this, message_t *message)
                /* query all pools until we get an address */
                DBG1(DBG_IKE, "peer requested virtual IP %H", requested);
 
-               found = hydra->attributes->acquire_address(hydra->attributes,
-                                                                                                  pools, id, requested);
+               found = charon->attributes->acquire_address(charon->attributes,
+                                                                                                       pools, id, requested);
                if (found)
                {
                        DBG1(DBG_IKE, "assigning virtual IP %H to peer '%Y'", found, id);
@@ -509,8 +508,8 @@ static status_t build_reply(private_mode_config_t *this, message_t *message)
        charon->bus->assign_vips(charon->bus, this->ike_sa, TRUE);
 
        /* query registered providers for additional attributes to include */
-       enumerator = hydra->attributes->create_responder_enumerator(
-                                                                                       hydra->attributes, pools, id, vips);
+       enumerator = charon->attributes->create_responder_enumerator(
+                                                                                       charon->attributes, pools, id, vips);
        while (enumerator->enumerate(enumerator, &type, &value))
        {
                cp->add_attribute(cp,
index da06e2a36705da34db965475fdc525c7ff71341b..e0602010e1d762bc1cb85b0a4755b73cc37eda12 100644 (file)
@@ -17,7 +17,6 @@
 #include "ike_config.h"
 
 #include <daemon.h>
-#include <hydra.h>
 #include <encoding/payloads/cp_payload.h>
 
 typedef struct private_ike_config_t private_ike_config_t;
@@ -127,7 +126,7 @@ static void handle_attribute(private_ike_config_t *this,
        enumerator->destroy(enumerator);
 
        /* and pass it to the handle function */
-       handler = hydra->attributes->handle(hydra->attributes,
+       handler = charon->attributes->handle(charon->attributes,
                                                        this->ike_sa->get_other_id(this->ike_sa), handler,
                                                        ca->get_type(ca), ca->get_chunk(ca));
        this->ike_sa->add_configuration_attribute(this->ike_sa,
@@ -274,8 +273,8 @@ METHOD(task_t, build_i, status_t,
                        enumerator->destroy(enumerator);
                }
 
-               enumerator = hydra->attributes->create_initiator_enumerator(
-                                                               hydra->attributes,
+               enumerator = charon->attributes->create_initiator_enumerator(
+                                                               charon->attributes,
                                                                this->ike_sa->get_other_id(this->ike_sa), vips);
                while (enumerator->enumerate(enumerator, &handler, &type, &data))
                {
@@ -352,8 +351,8 @@ METHOD(task_t, build_r, status_t,
                        /* query all pools until we get an address */
                        DBG1(DBG_IKE, "peer requested virtual IP %H", requested);
 
-                       found = hydra->attributes->acquire_address(hydra->attributes,
-                                                                                                          pools, id, requested);
+                       found = charon->attributes->acquire_address(charon->attributes,
+                                                                                                               pools, id, requested);
                        if (found)
                        {
                                DBG1(DBG_IKE, "assigning virtual IP %H to peer '%Y'", found, id);
@@ -398,8 +397,8 @@ METHOD(task_t, build_r, status_t,
                }
 
                /* query registered providers for additional attributes to include */
-               enumerator = hydra->attributes->create_responder_enumerator(
-                                                                                       hydra->attributes, pools, id, vips);
+               enumerator = charon->attributes->create_responder_enumerator(
+                                                                                       charon->attributes, pools, id, vips);
                while (enumerator->enumerate(enumerator, &type, &value))
                {
                        if (!cp)
index 317e019c169b5bf7895ad97d0524c7248bff9e09..c8be2859438880386c80e0c38ab8115ec3e5003e 100644 (file)
@@ -3,6 +3,7 @@ TESTS = libcharon_tests
 check_PROGRAMS = $(TESTS)
 
 libcharon_tests_SOURCES = \
+  suites/test_mem_pool.c \
   libcharon_tests.h libcharon_tests.c
 
 libcharon_tests_CFLAGS = \
index 05502f18e239bb7e772d428dc0b5674a421d127c..dc9681aeb37e73a480df85f3710428da856bf243 100644 (file)
@@ -12,3 +12,5 @@
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
  */
+
+TEST_SUITE(mem_pool_suite_create)
index fea4117b8bc23e18ad5550f2ee297977a3daa960..af39f04ec0a6598237ab413ea2d3f54a80116d71 100644 (file)
@@ -4,10 +4,6 @@ include $(CLEAR_VARS)
 # copy-n-paste from Makefile.am
 libhydra_la_SOURCES := \
 hydra.c hydra.h \
-attributes/attributes.c attributes/attributes.h \
-attributes/attribute_provider.h attributes/attribute_handler.h \
-attributes/attribute_manager.c attributes/attribute_manager.h \
-attributes/mem_pool.c attributes/mem_pool.h \
 kernel/kernel_interface.c kernel/kernel_interface.h \
 kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
 kernel/kernel_net.c kernel/kernel_net.h \
index e1537c1fb1771b5b140c25a6a1da8c16b597a2d4..9cdbc0147320cd414e3f263840d1c11473f819b7 100644 (file)
@@ -2,10 +2,6 @@ ipseclib_LTLIBRARIES = libhydra.la
 
 libhydra_la_SOURCES = \
 hydra.c hydra.h \
-attributes/attributes.c attributes/attributes.h \
-attributes/attribute_provider.h attributes/attribute_handler.h \
-attributes/attribute_manager.c attributes/attribute_manager.h \
-attributes/mem_pool.c attributes/mem_pool.h \
 kernel/kernel_interface.c kernel/kernel_interface.h \
 kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
 kernel/kernel_net.c kernel/kernel_net.h \
index 1b50650815bea307bfc5b20759c821dcf0b5dee9..47ffb59c60d8ca5a48c798c2b5a5311e5f7bc31f 100644 (file)
@@ -57,7 +57,6 @@ void libhydra_deinit()
                return;
        }
 
-       this->public.attributes->destroy(this->public.attributes);
        this->public.kernel_interface->destroy(this->public.kernel_interface);
        free(this);
        hydra = NULL;
@@ -78,9 +77,6 @@ bool libhydra_init()
        }
 
        INIT(this,
-               .public = {
-                       .attributes = attribute_manager_create(),
-               },
                .ref = 1,
        );
        hydra = &this->public;
index 94209ff59e3ff1cc7376332ae39bb0101a5d4144..b23a30584f784b2ffb6acd7745055778b9906086 100644 (file)
@@ -16,9 +16,6 @@
 /**
  * @defgroup libhydra libhydra
  *
- * @defgroup attributes attributes
- * @ingroup libhydra
- *
  * @defgroup hkernel kernel
  * @ingroup libhydra
  *
@@ -34,7 +31,6 @@
 
 typedef struct hydra_t hydra_t;
 
-#include <attributes/attribute_manager.h>
 #include <kernel/kernel_interface.h>
 
 #include <library.h>
@@ -44,11 +40,6 @@ typedef struct hydra_t hydra_t;
  */
 struct hydra_t {
 
-       /**
-        * manager for payload attributes
-        */
-       attribute_manager_t *attributes;
-
        /**
         * kernel interface to communicate with kernel
         */
index c2377c1607fd6b301cd470ac94cd0757e8cfefac..5acd5c28cf35cc5c55ed285f1cceb98981834bfa 100644 (file)
@@ -3,7 +3,6 @@ TESTS = hydra_tests
 check_PROGRAMS = $(TESTS)
 
 hydra_tests_SOURCES = \
-  suites/test_mem_pool.c \
   hydra_tests.h hydra_tests.c
 
 hydra_tests_CFLAGS = \
index a73b78dc7c730d0897df4af0d625305fb9f70c4f..6b213d026b00c39c5c8942affc23680111afd56d 100644 (file)
@@ -12,5 +12,3 @@
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
  */
-
-TEST_SUITE(mem_pool_suite_create)