- added definitions from IKEv2 draft

This commit is contained in:
Martin Willi committed 2005-11-16 16:12:31 +00:00
1 parent 02d3cba7ce
commit 7eeeaf4e4f
4 files changed
+293 -8

No files matched your search

+46 -6
View File
@@ -68,6 +68,16 @@ struct private_transform_attribute_s {
};
/**
* string mappings for transform_attribute_type_t
*/
mapping_t transform_attribute_type_m[] = {
{ATTRIBUTE_UNDEFINED, "ATTRIBUTE_UNDEFINED"},
{KEY_LENGTH, "KEY_LENGTH"},
{MAPPING_END, NULL}
};
/**
* Encoding rules to parse or generate a Transform attribute
*
@@ -157,7 +167,7 @@ static size_t get_length(private_transform_attribute_t *this)
* Implements transform_attribute_t's set_value function.
* See #transform_attribute_s.set_value for description.
*/
static status_t set_value (private_transform_attribute_t *this, chunk_t value)
static status_t set_value_chunk(private_transform_attribute_t *this, chunk_t value)
{
if (this->attribute_value.ptr != NULL)
{
@@ -188,10 +198,28 @@ static status_t set_value (private_transform_attribute_t *this, chunk_t value)
}
/**
* Implements transform_attribute_t's get_value function.
* See #transform_attribute_s.get_value for description.
* Implements transform_attribute_t's set_value function.
* See #transform_attribute_s.set_value for description.
*/
static chunk_t get_value (private_transform_attribute_t *this)
static status_t set_value(private_transform_attribute_t *this, u_int16_t value)
{
if (this->attribute_value.ptr != NULL)
{
/* free existing value */
allocator_free(this->attribute_value.ptr);
this->attribute_value.ptr = NULL;
this->attribute_value.len = 0;
}
this->attribute_length_or_value = value;
return SUCCESS;
}
/**
* Implements transform_attribute_t's get_value_chunk function.
* See #transform_attribute_s.get_value_chunk for description.
*/
static chunk_t get_value_chunk (private_transform_attribute_t *this)
{
chunk_t value;
@@ -209,6 +237,16 @@ static chunk_t get_value (private_transform_attribute_t *this)
return value;
}
/**
* Implements transform_attribute_t's get_value function.
* See #transform_attribute_s.get_value for description.
*/
static u_int16_t get_value (private_transform_attribute_t *this)
{
return this->attribute_length_or_value;
}
/**
* Implements transform_attribute_t's set_attribute_type function.
* See #transform_attribute_s.set_attribute_type for description.
@@ -245,8 +283,10 @@ transform_attribute_t *transform_attribute_create()
this->public.payload_interface.set_next_type = (status_t (*) (payload_t *,payload_type_t)) set_next_type;
this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_type;
this->public.payload_interface.destroy = (status_t (*) (payload_t *))destroy;
this->public.set_value = (status_t (*) (transform_attribute_t *,chunk_t value)) set_value;
this->public.get_value = (chunk_t (*) (transform_attribute_t *)) get_value;
this->public.set_value_chunk = (status_t (*) (transform_attribute_t *,chunk_t)) set_value_chunk;
this->public.set_value = (status_t (*) (transform_attribute_t *,u_int16_t)) set_value;
this->public.get_value_chunk = (chunk_t (*) (transform_attribute_t *)) get_value_chunk;
this->public.get_value = (u_int16_t (*) (transform_attribute_t *)) get_value;
this->public.set_attribute_type = (status_t (*) (transform_attribute_t *,u_int16_t type)) set_attribute_type;
this->public.get_attribute_type = (u_int16_t (*) (transform_attribute_t *)) get_attribute_type;
this->public.destroy = (status_t (*) (transform_attribute_t *)) destroy;