}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_dhcp_provider_t *this, char *pool, identification_t *id,
+ private_dhcp_provider_t *this, linked_list_t *pools, identification_t *id,
linked_list_t *vips)
{
dhcp_transaction_t *transaction = NULL;
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_stroke_attribute_t *this, char *pool, identification_t *id,
- linked_list_t *vips)
+ private_stroke_attribute_t *this, linked_list_t *pools,
+ identification_t *id, linked_list_t *vips)
{
ike_sa_t *ike_sa;
peer_cfg_t *peer_cfg;
cp_payload_t *cp = NULL;
peer_cfg_t *config;
identification_t *id;
- linked_list_t *vips;
+ linked_list_t *vips, *pools;
char *pool;
id = this->ike_sa->get_other_eap_id(this->ike_sa);
{
vips->insert_last(vips, vip);
}
+ pools = linked_list_create();
+ /* TODO: use list of all pools */
+ if (pool)
+ {
+ pools->insert_last(pools, pool);
+ }
enumerator = hydra->attributes->create_responder_enumerator(
- hydra->attributes, pool, id, vips);
+ hydra->attributes, pools, id, vips);
while (enumerator->enumerate(enumerator, &type, &value))
{
if (!cp)
}
enumerator->destroy(enumerator);
vips->destroy(vips);
+ pools->destroy(pools);
if (cp)
{
cp_payload_t *cp = NULL;
peer_cfg_t *config;
identification_t *id;
- linked_list_t *vips;
+ linked_list_t *vips, *pools;
char *pool;
id = this->ike_sa->get_other_eap_id(this->ike_sa);
{
vips->insert_last(vips, vip);
}
+ pools = linked_list_create();
+ /* TODO: use list of all pools */
+ if (pool)
+ {
+ pools->insert_last(pools, pool);
+ }
enumerator = hydra->attributes->create_responder_enumerator(
- hydra->attributes, pool, id, vips);
+ hydra->attributes, pools, id, vips);
while (enumerator->enumerate(enumerator, &type, &value))
{
if (!cp)
}
enumerator->destroy(enumerator);
vips->destroy(vips);
+ pools->destroy(pools);
if (cp)
{
* Data to pass to enumerator filters
*/
typedef struct {
- /** attribute group pool */
- char *pool;
+ /** attribute group pools */
+ linked_list_t *pools;
/** server/peer identity */
identification_t *id;
/** requesting/assigned virtual IPs */
static enumerator_t *responder_enum_create(attribute_provider_t *provider,
enum_data_t *data)
{
- return provider->create_attribute_enumerator(provider, data->pool,
+ return provider->create_attribute_enumerator(provider, data->pools,
data->id, data->vips);
}
METHOD(attribute_manager_t, create_responder_enumerator, enumerator_t*,
- private_attribute_manager_t *this, char *pool, identification_t *id,
- linked_list_t *vips)
+ private_attribute_manager_t *this, linked_list_t *pools,
+ identification_t *id, linked_list_t *vips)
{
enum_data_t *data;
INIT(data,
- .pool = pool,
+ .pools = pools,
.id = id,
.vips = vips,
);
/**
* Create an enumerator over attributes to hand out to a peer.
*
- * @param pool pool name to get attributes from
+ * @param pool list of pools names (char*) to query attributes from
* @param id peer identity to hand out attributes to
* @param vip list of virtual IPs (host_t*) to assign to peer
* @return enumerator (configuration_attribute_type_t, chunk_t)
*/
enumerator_t* (*create_responder_enumerator)(attribute_manager_t *this,
- char *pool, identification_t *id, linked_list_t *vips);
+ linked_list_t *pool, identification_t *id,
+ linked_list_t *vips);
/**
* Register an attribute provider to the manager.
/**
* Create an enumerator over attributes to hand out to a peer.
*
- * @param pool pool name to get attributes from
+ * @param pool list of pools names (char*) to query attributes from
* @param id peer ID
* @param vip list of virtual IPs (host_t*) to assign to peer
* @return enumerator (configuration_attribute_type_t, chunk_t)
*/
enumerator_t* (*create_attribute_enumerator)(attribute_provider_t *this,
- char *pool, identification_t *id, linked_list_t *vips);
+ linked_list_t *pools, identification_t *id,
+ linked_list_t *vips);
};
#endif /** ATTRIBUTE_PROVIDER_H_ @}*/
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_attr_provider_t *this, char *pool,
+ private_attr_provider_t *this, linked_list_t *pools,
identification_t *id, linked_list_t *vips)
{
if (vips->get_count(vips))
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_sql_attribute_t *this, char *names, identification_t *id,
+ private_sql_attribute_t *this, linked_list_t *pools, identification_t *id,
linked_list_t *vips)
{
enumerator_t *attr_enumerator = NULL;
if (vips->get_count(vips))
{
- enumerator_t *names_enumerator;
+ enumerator_t *pool_enumerator;
u_int count;
char *name;
{
u_int identity = get_identity(this, id);
- names_enumerator = enumerator_create_token(names, ",", " ");
- while (names_enumerator->enumerate(names_enumerator, &name))
+ pool_enumerator = pools->create_enumerator(pools);
+ while (pool_enumerator->enumerate(pool_enumerator, &name))
{
u_int attr_pool = get_attr_pool(this, name);
if (!attr_pool)
DESTROY_IF(attr_enumerator);
attr_enumerator = NULL;
}
- names_enumerator->destroy(names_enumerator);
+ pool_enumerator->destroy(pool_enumerator);
}
/* in a second step check for attributes that match name */
if (!attr_enumerator)
{
- names_enumerator = enumerator_create_token(names, ",", " ");
- while (names_enumerator->enumerate(names_enumerator, &name))
+ pool_enumerator = pools->create_enumerator(pools);
+ while (pool_enumerator->enumerate(pool_enumerator, &name))
{
u_int attr_pool = get_attr_pool(this, name);
if (!attr_pool)
DESTROY_IF(attr_enumerator);
attr_enumerator = NULL;
}
- names_enumerator->destroy(names_enumerator);
+ pool_enumerator->destroy(pool_enumerator);
}
this->db->execute(this->db, NULL, "END TRANSACTION");