moved attribute_manager to libstrongswan

This commit is contained in:
Andreas Steffen
2009-10-13 13:46:27 +02:00
parent a2b50c5d60
commit 930443afff
31 changed files with 181 additions and 125 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ struct private_attr_plugin_t {
*/
static void destroy(private_attr_plugin_t *this)
{
charon->attributes->remove_provider(charon->attributes, &this->provider->provider);
lib->attributes->remove_provider(lib->attributes, &this->provider->provider);
this->provider->destroy(this->provider);
free(this);
}
@@ -56,7 +56,7 @@ plugin_t *plugin_create()
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
this->provider = attr_provider_create();
charon->attributes->add_provider(charon->attributes, &this->provider->provider);
lib->attributes->add_provider(lib->attributes, &this->provider->provider);
return &this->public.plugin;
}
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef ATTR_PROVIDER_H_
#define ATTR_PROVIDER_H_
#include <config/attributes/attribute_provider.h>
#include <attributes/attribute_provider.h>
typedef struct attr_provider_t attr_provider_t;
+3 -3
View File
@@ -43,7 +43,7 @@ struct private_nm_handler_t {
/**
* Implementation of attribute_handler_t.handle
*/
static bool handle(private_nm_handler_t *this, ike_sa_t *ike_sa,
static bool handle(private_nm_handler_t *this, identification_t *server,
configuration_attribute_type_t type, chunk_t data)
{
linked_list_t *list;
@@ -134,8 +134,8 @@ nm_handler_t *nm_handler_create()
{
private_nm_handler_t *this = malloc_thing(private_nm_handler_t);
this->public.handler.handle = (bool(*)(attribute_handler_t*, ike_sa_t*, configuration_attribute_type_t, chunk_t))handle;
this->public.handler.release = (void(*)(attribute_handler_t*, ike_sa_t*, configuration_attribute_type_t, chunk_t))nop;
this->public.handler.handle = (bool(*)(attribute_handler_t*, identification_t*, configuration_attribute_type_t, chunk_t))handle;
this->public.handler.release = (void(*)(attribute_handler_t*, identification_t*, configuration_attribute_type_t, chunk_t))nop;
this->public.create_enumerator = (enumerator_t*(*)(nm_handler_t*, configuration_attribute_type_t type))create_enumerator;
this->public.reset = (void(*)(nm_handler_t*))reset;
this->public.destroy = (void(*)(nm_handler_t*))destroy;
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef NM_HANDLER_H_
#define NM_HANDLER_H_
#include <config/attributes/attribute_handler.h>
#include <attributes/attribute_handler.h>
typedef struct nm_handler_t nm_handler_t;
+2 -2
View File
@@ -84,8 +84,8 @@ static void destroy(private_nm_plugin_t *this)
g_object_unref(this->plugin);
}
charon->credentials->remove_set(charon->credentials, &this->creds->set);
lib->attributes->remove_handler(lib->attributes, &this->handler->handler);
this->creds->destroy(this->creds);
charon->attributes->remove_handler(charon->attributes, &this->handler->handler);
this->handler->destroy(this->handler);
free(this);
}
@@ -108,8 +108,8 @@ plugin_t *plugin_create()
this->creds = nm_creds_create();
this->handler = nm_handler_create();
lib->attributes->add_handler(lib->attributes, &this->handler->handler);
charon->credentials->add_set(charon->credentials, &this->creds->set);
charon->attributes->add_handler(charon->attributes, &this->handler->handler);
this->plugin = nm_strongswan_plugin_new(this->creds, this->handler);
if (!this->plugin)
{
+6 -6
View File
@@ -46,7 +46,7 @@ struct private_resolve_handler_t {
/**
* Implementation of attribute_handler_t.handle
*/
static bool handle(private_resolve_handler_t *this, ike_sa_t *ike_sa,
static bool handle(private_resolve_handler_t *this, identification_t *server,
configuration_attribute_type_t type, chunk_t data)
{
FILE *in, *out;
@@ -78,7 +78,7 @@ static bool handle(private_resolve_handler_t *this, ike_sa_t *ike_sa,
{
addr = host_create_from_chunk(family, data, 0);
fprintf(out, "nameserver %H # by strongSwan, from %Y\n",
addr, ike_sa->get_other_id(ike_sa));
addr, server);
DBG1(DBG_IKE, "installing DNS server %H to %s", addr, this->file);
addr->destroy(addr);
handled = TRUE;
@@ -106,7 +106,7 @@ static bool handle(private_resolve_handler_t *this, ike_sa_t *ike_sa,
/**
* Implementation of attribute_handler_t.release
*/
static void release(private_resolve_handler_t *this, ike_sa_t *ike_sa,
static void release(private_resolve_handler_t *this, identification_t *server,
configuration_attribute_type_t type, chunk_t data)
{
FILE *in, *out;
@@ -139,7 +139,7 @@ static void release(private_resolve_handler_t *this, ike_sa_t *ike_sa,
addr = host_create_from_chunk(family, data, 0);
snprintf(matcher, sizeof(matcher),
"nameserver %H # by strongSwan, from %Y\n",
addr, ike_sa->get_other_id(ike_sa));
addr, server);
/* copy all, but matching line */
while ((pos = fgets(line, sizeof(line), in)))
@@ -179,8 +179,8 @@ resolve_handler_t *resolve_handler_create()
{
private_resolve_handler_t *this = malloc_thing(private_resolve_handler_t);
this->public.handler.handle = (bool(*)(attribute_handler_t*, ike_sa_t*, configuration_attribute_type_t, chunk_t))handle;
this->public.handler.release = (void(*)(attribute_handler_t*, ike_sa_t*, configuration_attribute_type_t, chunk_t))release;
this->public.handler.handle = (bool(*)(attribute_handler_t*, identification_t*, configuration_attribute_type_t, chunk_t))handle;
this->public.handler.release = (void(*)(attribute_handler_t*, identification_t*, configuration_attribute_type_t, chunk_t))release;
this->public.destroy = (void(*)(resolve_handler_t*))destroy;
this->mutex = mutex_create(MUTEX_TYPE_DEFAULT);
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef RESOLVE_HANDLER_H_
#define RESOLVE_HANDLER_H_
#include <config/attributes/attribute_handler.h>
#include <attributes/attribute_handler.h>
typedef struct resolve_handler_t resolve_handler_t;
+2 -3
View File
@@ -41,8 +41,7 @@ struct private_resolve_plugin_t {
*/
static void destroy(private_resolve_plugin_t *this)
{
charon->attributes->remove_handler(charon->attributes,
&this->handler->handler);
lib->attributes->remove_handler(lib->attributes, &this->handler->handler);
this->handler->destroy(this->handler);
free(this);
}
@@ -56,7 +55,7 @@ plugin_t *plugin_create()
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
this->handler = resolve_handler_create();
charon->attributes->add_handler(charon->attributes, &this->handler->handler);
lib->attributes->add_handler(lib->attributes, &this->handler->handler);
return &this->public.plugin;
}
+2 -1
View File
@@ -21,7 +21,8 @@
#ifndef SQL_ATTRIBUTE_H_
#define SQL_ATTRIBUTE_H_
#include <config/attributes/attribute_provider.h>
#include <attributes/attribute_provider.h>
#include <database/database.h>
typedef struct sql_attribute_t sql_attribute_t;
+2 -2
View File
@@ -66,8 +66,8 @@ static void destroy(private_sql_plugin_t *this)
{
charon->backends->remove_backend(charon->backends, &this->config->backend);
charon->credentials->remove_set(charon->credentials, &this->cred->set);
charon->attributes->remove_provider(charon->attributes, &this->attribute->provider);
charon->bus->remove_listener(charon->bus, &this->logger->listener);
lib->attributes->remove_provider(lib->attributes, &this->attribute->provider);
this->config->destroy(this->config);
this->cred->destroy(this->cred);
this->attribute->destroy(this->attribute);
@@ -107,9 +107,9 @@ plugin_t *plugin_create()
this->attribute = sql_attribute_create(this->db);
this->logger = sql_logger_create(this->db);
lib->attributes->add_provider(lib->attributes, &this->attribute->provider);
charon->backends->add_backend(charon->backends, &this->config->backend);
charon->credentials->add_set(charon->credentials, &this->cred->set);
charon->attributes->add_provider(charon->attributes, &this->attribute->provider);
charon->bus->add_listener(charon->bus, &this->logger->listener);
return &this->public.plugin;
+1 -1
View File
@@ -22,7 +22,7 @@
#define STROKE_ATTRIBUTE_H_
#include <stroke_msg.h>
#include <config/attributes/attribute_provider.h>
#include <attributes/attribute_provider.h>
typedef struct stroke_attribute_t stroke_attribute_t;
+2 -2
View File
@@ -625,7 +625,7 @@ static void destroy(private_stroke_socket_t *this)
charon->credentials->remove_set(charon->credentials, &this->ca->set);
charon->credentials->remove_set(charon->credentials, &this->cred->set);
charon->backends->remove_backend(charon->backends, &this->config->backend);
charon->attributes->remove_provider(charon->attributes, &this->attribute->provider);
lib->attributes->remove_provider(lib->attributes, &this->attribute->provider);
this->cred->destroy(this->cred);
this->ca->destroy(this->ca);
this->config->destroy(this->config);
@@ -660,7 +660,7 @@ stroke_socket_t *stroke_socket_create()
charon->credentials->add_set(charon->credentials, &this->ca->set);
charon->credentials->add_set(charon->credentials, &this->cred->set);
charon->backends->add_backend(charon->backends, &this->config->backend);
charon->attributes->add_provider(charon->attributes, &this->attribute->provider);
lib->attributes->add_provider(lib->attributes, &this->attribute->provider);
this->job = callback_job_create((callback_job_cb_t)receive,
this, NULL, NULL);