Attributes moved from libstrongswan to libhydra.
The attribute_manager_t instance is now located on the new hydra object instead of the lib object.
This commit is contained in:
@@ -28,9 +28,6 @@
|
||||
* @defgroup config config
|
||||
* @ingroup libcharon
|
||||
*
|
||||
* @defgroup attributes attributes
|
||||
* @ingroup config
|
||||
*
|
||||
* @defgroup control control
|
||||
* @ingroup libcharon
|
||||
*
|
||||
|
||||
@@ -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 =
|
||||
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
/**
|
||||
* @defgroup libhydra libhydra
|
||||
*
|
||||
* @defgroup attributes attributes
|
||||
* @ingroup libhydra
|
||||
*
|
||||
* @defgroup hplugins plugins
|
||||
* @ingroup libhydra
|
||||
*
|
||||
@@ -26,8 +29,28 @@
|
||||
#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
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user