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
+4 -3
View File
@@ -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);
+13 -14
View File
@@ -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,
+7 -8
View File
@@ -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)