diff options
author | Tobias Brunner <tobias@strongswan.org> | 2010-03-24 17:40:15 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2010-03-24 18:53:10 +0100 |
commit | 567d3f14639f769b1b2a6ba4dd327ef0b4960c06 (patch) | |
tree | 16590335d50ddf5aedc5ca7ec2e3e98145e96b64 | |
parent | 83218f0d6552019323b4e11c453632e121d3faa8 (diff) | |
download | strongswan-567d3f14639f769b1b2a6ba4dd327ef0b4960c06.tar.bz2 strongswan-567d3f14639f769b1b2a6ba4dd327ef0b4960c06.tar.xz |
Attributes moved from libstrongswan to libhydra.
The attribute_manager_t instance is now located on the new hydra object
instead of the lib object.
-rw-r--r-- | src/libcharon/daemon.h | 3 | ||||
-rw-r--r-- | src/libhydra/Makefile.am | 5 | ||||
-rw-r--r-- | src/libhydra/attributes/attribute_handler.h (renamed from src/libstrongswan/attributes/attribute_handler.h) | 0 | ||||
-rw-r--r-- | src/libhydra/attributes/attribute_manager.c (renamed from src/libstrongswan/attributes/attribute_manager.c) | 0 | ||||
-rw-r--r-- | src/libhydra/attributes/attribute_manager.h (renamed from src/libstrongswan/attributes/attribute_manager.h) | 0 | ||||
-rw-r--r-- | src/libhydra/attributes/attribute_provider.h (renamed from src/libstrongswan/attributes/attribute_provider.h) | 0 | ||||
-rw-r--r-- | src/libhydra/attributes/attributes.c (renamed from src/libstrongswan/attributes/attributes.c) | 0 | ||||
-rw-r--r-- | src/libhydra/attributes/attributes.h (renamed from src/libstrongswan/attributes/attributes.h) | 0 | ||||
-rw-r--r-- | src/libhydra/hydra.c | 30 | ||||
-rw-r--r-- | src/libhydra/hydra.h | 23 | ||||
-rw-r--r-- | src/libstrongswan/Makefile.am | 3 | ||||
-rw-r--r-- | src/libstrongswan/library.c | 2 | ||||
-rw-r--r-- | src/libstrongswan/library.h | 6 |
13 files changed, 57 insertions, 15 deletions
diff --git a/src/libcharon/daemon.h b/src/libcharon/daemon.h index eb97a1688..c1df00e65 100644 --- a/src/libcharon/daemon.h +++ b/src/libcharon/daemon.h @@ -28,9 +28,6 @@ * @defgroup config config * @ingroup libcharon * - * @defgroup attributes attributes - * @ingroup config - * * @defgroup control control * @ingroup libcharon * diff --git a/src/libhydra/Makefile.am b/src/libhydra/Makefile.am index 35a807ef4..94d3968de 100644 --- a/src/libhydra/Makefile.am +++ b/src/libhydra/Makefile.am @@ -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 = diff --git a/src/libstrongswan/attributes/attribute_handler.h b/src/libhydra/attributes/attribute_handler.h index d042f47ef..d042f47ef 100644 --- a/src/libstrongswan/attributes/attribute_handler.h +++ b/src/libhydra/attributes/attribute_handler.h diff --git a/src/libstrongswan/attributes/attribute_manager.c b/src/libhydra/attributes/attribute_manager.c index 91fa1ebb5..91fa1ebb5 100644 --- a/src/libstrongswan/attributes/attribute_manager.c +++ b/src/libhydra/attributes/attribute_manager.c diff --git a/src/libstrongswan/attributes/attribute_manager.h b/src/libhydra/attributes/attribute_manager.h index 642662366..642662366 100644 --- a/src/libstrongswan/attributes/attribute_manager.h +++ b/src/libhydra/attributes/attribute_manager.h diff --git a/src/libstrongswan/attributes/attribute_provider.h b/src/libhydra/attributes/attribute_provider.h index f8485cc6c..f8485cc6c 100644 --- a/src/libstrongswan/attributes/attribute_provider.h +++ b/src/libhydra/attributes/attribute_provider.h diff --git a/src/libstrongswan/attributes/attributes.c b/src/libhydra/attributes/attributes.c index 83feed17e..83feed17e 100644 --- a/src/libstrongswan/attributes/attributes.c +++ b/src/libhydra/attributes/attributes.c diff --git a/src/libstrongswan/attributes/attributes.h b/src/libhydra/attributes/attributes.h index f4a396f21..f4a396f21 100644 --- a/src/libstrongswan/attributes/attributes.h +++ b/src/libhydra/attributes/attributes.h diff --git a/src/libhydra/hydra.c b/src/libhydra/hydra.c index edc48f748..8775df08c 100644 --- a/src/libhydra/hydra.c +++ b/src/libhydra/hydra.c @@ -17,11 +17,32 @@ #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)) { diff --git a/src/libhydra/hydra.h b/src/libhydra/hydra.h index acbaa01cc..2d8ef9cc1 100644 --- a/src/libhydra/hydra.h +++ b/src/libhydra/hydra.h @@ -16,6 +16,9 @@ /** * @defgroup libhydra libhydra * + * @defgroup attributes attributes + * @ingroup libhydra + * * @defgroup hplugins plugins * @ingroup libhydra * @@ -26,9 +29,29 @@ #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 */ diff --git a/src/libstrongswan/Makefile.am b/src/libstrongswan/Makefile.am index 5620ff74b..157d37b5e 100644 --- a/src/libstrongswan/Makefile.am +++ b/src/libstrongswan/Makefile.am @@ -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 \ diff --git a/src/libstrongswan/library.c b/src/libstrongswan/library.c index 10d94a23b..02ac0cb31 100644 --- a/src/libstrongswan/library.c +++ b/src/libstrongswan/library.c @@ -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; diff --git a/src/libstrongswan/library.h b/src/libstrongswan/library.h index ffc0b1c46..241084155 100644 --- a/src/libstrongswan/library.h +++ b/src/libstrongswan/library.h @@ -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" @@ -101,11 +100,6 @@ struct library_t { fetcher_manager_t *fetcher; /** - * manager for payload attributes - */ - attribute_manager_t *attributes; - - /** * database construction factory */ database_factory_t *db; |