attributes: Move the configuration attributes framework to libcharon
This commit is contained in:
parent
1f29cd2c5d
commit
751363275f
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -345,4 +345,3 @@ attribute_manager_t *attribute_manager_create()
|
|||
|
||||
return &this->public;
|
||||
}
|
||||
|
|
@ -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();
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
/**
|
||||
* @defgroup libcharon libcharon
|
||||
*
|
||||
* @defgroup attributes attributes
|
||||
* @ingroup libcharon
|
||||
*
|
||||
* @defgroup bus bus
|
||||
* @ingroup libcharon
|
||||
*
|
||||
|
@ -152,6 +155,7 @@
|
|||
|
||||
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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 = \
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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 = \
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue