attributes: Move the configuration attributes framework to libcharon

This commit is contained in:
Martin Willi
2015-02-20 13:34:55 +01:00
parent 1f29cd2c5d
commit 751363275f
40 changed files with 119 additions and 129 deletions
@@ -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;
}
+5 -5
View File
@@ -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;
}
+1 -1
View File
@@ -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);
}
+4 -5
View File
@@ -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);
+4 -6
View File
@@ -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;
}
+8 -5
View File
@@ -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;
}
+8 -9
View File
@@ -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;
+4 -5
View File
@@ -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;
+4 -5
View File
@@ -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);