Implemented encoding of additional IKEv1 proposal attributes

This commit is contained in:
Martin Willi
2012-03-20 17:30:53 +01:00
parent cd0017d452
commit fbebc2a068
5 changed files with 173 additions and 123 deletions
@@ -290,13 +290,28 @@ transform_attribute_t *transform_attribute_create(payload_type_t type)
* Described in header.
*/
transform_attribute_t *transform_attribute_create_value(payload_type_t type,
transform_attribute_type_t kind, u_int16_t value)
transform_attribute_type_t kind, u_int64_t value)
{
transform_attribute_t *attribute;
attribute = transform_attribute_create(type);
attribute->set_attribute_type(attribute, kind);
attribute->set_value(attribute, value);
if (value <= UINT16_MAX)
{
attribute->set_value(attribute, value);
}
else if (value <= UINT32_MAX)
{
u_int32_t val32;
val32 = htonl(value);
attribute->set_value_chunk(attribute, chunk_from_thing(val32));
}
else
{
value = htobe64(value);
attribute->set_value_chunk(attribute, chunk_from_thing(value));
}
return attribute;
}