ike: Create an enumerator for (un-)handled configuration attributes on IKE_SA

This commit is contained in:
Martin Willi
2014-06-16 15:59:17 +02:00
parent 5ae3221075
commit 9d257034d8
2 changed files with 32 additions and 0 deletions
+21
View File
@@ -2001,6 +2001,26 @@ METHOD(ike_sa_t, add_configuration_attribute, void,
array_insert(this->attributes, ARRAY_TAIL, &entry);
}
/**
* Enumerator filter for attributes
*/
static bool filter_attribute(void *null, attribute_entry_t **in,
configuration_attribute_type_t *type, void *in2,
chunk_t *data, void *in3, bool *handled)
{
*type = (*in)->type;
*data = (*in)->data;
*handled = (*in)->handler != NULL;
return TRUE;
}
METHOD(ike_sa_t, create_attribute_enumerator, enumerator_t*,
private_ike_sa_t *this)
{
return enumerator_create_filter(array_create_enumerator(this->attributes),
(void*)filter_attribute, NULL, NULL);
}
METHOD(ike_sa_t, create_task_enumerator, enumerator_t*,
private_ike_sa_t *this, task_queue_t queue)
{
@@ -2317,6 +2337,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id, bool initiator,
.clear_virtual_ips = _clear_virtual_ips,
.create_virtual_ip_enumerator = _create_virtual_ip_enumerator,
.add_configuration_attribute = _add_configuration_attribute,
.create_attribute_enumerator = _create_attribute_enumerator,
.set_kmaddress = _set_kmaddress,
.create_task_enumerator = _create_task_enumerator,
.flush_queue = _flush_queue,
+11
View File
@@ -989,6 +989,17 @@ struct ike_sa_t {
attribute_handler_t *handler,
configuration_attribute_type_t type, chunk_t data);
/**
* Create an enumerator over received configuration attributes.
*
* The resulting enumerator is over the configuration_attribute_type_t type,
* a value chunk_t followed by a bool flag. The boolean flag indicates if
* the attribute has been handled by an attribute handler.
*
* @return enumerator over type, value and the "handled" flag.
*/
enumerator_t* (*create_attribute_enumerator)(ike_sa_t *this);
/**
* Set local and remote host addresses to be used for IKE.
*