]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Attributes moved from libstrongswan to libhydra.
authorTobias Brunner <tobias@strongswan.org>
Wed, 24 Mar 2010 16:40:15 +0000 (17:40 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 24 Mar 2010 17:53:10 +0000 (18:53 +0100)
The attribute_manager_t instance is now located on the new hydra object
instead of the lib object.

13 files changed:
src/libcharon/daemon.h
src/libhydra/Makefile.am
src/libhydra/attributes/attribute_handler.h [moved from src/libstrongswan/attributes/attribute_handler.h with 100% similarity]
src/libhydra/attributes/attribute_manager.c [moved from src/libstrongswan/attributes/attribute_manager.c with 100% similarity]
src/libhydra/attributes/attribute_manager.h [moved from src/libstrongswan/attributes/attribute_manager.h with 100% similarity]
src/libhydra/attributes/attribute_provider.h [moved from src/libstrongswan/attributes/attribute_provider.h with 100% similarity]
src/libhydra/attributes/attributes.c [moved from src/libstrongswan/attributes/attributes.c with 100% similarity]
src/libhydra/attributes/attributes.h [moved from src/libstrongswan/attributes/attributes.h with 100% similarity]
src/libhydra/hydra.c
src/libhydra/hydra.h
src/libstrongswan/Makefile.am
src/libstrongswan/library.c
src/libstrongswan/library.h

index eb97a1688a1d6f6936d2b497465b18e5c86bf19f..c1df00e6553aa0ff8b7a41e1921dca9ee8280b9b 100644 (file)
@@ -28,9 +28,6 @@
  * @defgroup config config
  * @ingroup libcharon
  *
- * @defgroup attributes attributes
- * @ingroup config
- *
  * @defgroup control control
  * @ingroup libcharon
  *
index 35a807ef4ca8941dd5f1d557393d1bd39fac76e6..94d3968de54eacc6e9fc296c2174418fc91d0bb1 100644 (file)
@@ -1,7 +1,10 @@
 lib_LTLIBRARIES = libhydra.la
 
 libhydra_la_SOURCES = \
-hydra.c hydra.h
+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
 
 libhydra_la_LIBADD =
 
index edc48f748227be0da206acacea425a40f3aa343d..8775df08c9448dd801d4daee6027bea932c87b9a 100644 (file)
 
 #include <debug.h>
 
+typedef struct private_hydra_t private_hydra_t;
+
+/**
+ * Private additions to hydra_t.
+ */
+struct private_hydra_t {
+       /**
+        * Public members of hydra_t.
+        */
+       hydra_t public;
+};
+
+/**
+ * Single instance of hydra_t.
+ */
+hydra_t *hydra;
+
 /**
  * Described in header.
  */
 void libhydra_deinit()
 {
+       private_hydra_t *this = (private_hydra_t*)hydra;
+       this->public.attributes->destroy(this->public.attributes);
+       free(this);
+       hydra = NULL;
 }
 
 /**
@@ -29,6 +50,15 @@ void libhydra_deinit()
  */
 bool libhydra_init()
 {
+       private_hydra_t *this;
+
+       INIT(this,
+               .public = {
+                       .attributes = attribute_manager_create(),
+               },
+       );
+       hydra = &this->public;
+
        if (lib->integrity &&
                !lib->integrity->check(lib->integrity, "libhydra", libhydra_init))
        {
index acbaa01ccd7b2dce3e93b818668b0a5949226e29..2d8ef9cc1cddead4ee91e7fd12afd90c55d251b0 100644 (file)
@@ -16,6 +16,9 @@
 /**
  * @defgroup libhydra libhydra
  *
+ * @defgroup attributes attributes
+ * @ingroup libhydra
+ *
  * @defgroup hplugins plugins
  * @ingroup libhydra
  *
 #ifndef HYDRA_H_
 #define HYDRA_H_
 
+typedef struct hydra_t hydra_t;
+
+#include <attributes/attribute_manager.h>
+
 #include <library.h>
 
+/**
+ * IKE Daemon support object.
+ */
+struct hydra_t {
+       /**
+        * manager for payload attributes
+        */
+       attribute_manager_t *attributes;
+};
+
+/**
+ * The single instance of hydra_t. Set between calls to libhydra_init() and
+ * libhydra_deinit() calls.
+ */
+extern hydra_t *hydra;
+
 /**
  * Initialize libhydra.
  * @return                             FALSE if integrity check failed
index 5620ff74b04d1aec636ba7a4f29a5a187d000c9f..157d37b5e22be2d4946748276040071a3a4b14d2 100644 (file)
@@ -10,9 +10,6 @@ printf_hook.c printf_hook.h \
 asn1/asn1.c asn1/asn1.h \
 asn1/asn1_parser.c asn1/asn1_parser.h \
 asn1/oid.c asn1/oid.h \
-attributes/attributes.c attributes/attributes.h \
-attributes/attribute_provider.h attributes/attribute_handler.h \
-attributes/attribute_manager.c attributes/attribute_manager.h \
 crypto/crypters/crypter.c crypto/crypters/crypter.h \
 crypto/hashers/hasher.h crypto/hashers/hasher.c \
 crypto/pkcs9.c crypto/pkcs9.h \
index 10d94a23bbcf9c11b7962b8a4397014aab286d74..02ac0cb31395587d775c16b888a46514b12c9ac8 100644 (file)
@@ -66,7 +66,6 @@ void library_deinit()
        this->public.encoding->destroy(this->public.encoding);
        this->public.crypto->destroy(this->public.crypto);
        this->public.fetcher->destroy(this->public.fetcher);
-       this->public.attributes->destroy(this->public.attributes);
        this->public.db->destroy(this->public.db);
        this->public.printf_hook->destroy(this->public.printf_hook);
        if (this->public.integrity)
@@ -131,7 +130,6 @@ bool library_init(char *settings)
        this->public.creds = credential_factory_create();
        this->public.encoding = key_encoding_create();
        this->public.fetcher = fetcher_manager_create();
-       this->public.attributes = attribute_manager_create();
        this->public.db = database_factory_create();
        this->public.plugins = plugin_loader_create();
        this->public.integrity = NULL;
index ffc0b1c466daa47b0242504001af89e381e93bd0..241084155476b376e88e322c16cfd21d9c6c0642 100644 (file)
@@ -63,7 +63,6 @@
 #include "plugins/plugin_loader.h"
 #include "crypto/crypto_factory.h"
 #include "fetcher/fetcher_manager.h"
-#include "attributes/attribute_manager.h"
 #include "database/database_factory.h"
 #include "credentials/credential_factory.h"
 #include "credentials/keys/key_encoding.h"
@@ -100,11 +99,6 @@ struct library_t {
         */
        fetcher_manager_t *fetcher;
 
-       /**
-        * manager for payload attributes
-        */
-       attribute_manager_t *attributes;
-
        /**
         * database construction factory
         */