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
+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;
}