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
+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,