* @defgroup config config
* @ingroup libcharon
*
- * @defgroup attributes attributes
- * @ingroup config
- *
* @defgroup control control
* @ingroup libcharon
*
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 =
#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;
}
/**
*/
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))
{
/**
* @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
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 \
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)
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;
#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"
*/
fetcher_manager_t *fetcher;
- /**
- * manager for payload attributes
- */
- attribute_manager_t *attributes;
-
/**
* database construction factory
*/