summaryrefslogtreecommitdiff
path: root/src/libcharon/encoding/payloads/configuration_attribute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/encoding/payloads/configuration_attribute.c')
-rw-r--r--src/libcharon/encoding/payloads/configuration_attribute.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/libcharon/encoding/payloads/configuration_attribute.c b/src/libcharon/encoding/payloads/configuration_attribute.c
index 9094fd44d..1ef8be800 100644
--- a/src/libcharon/encoding/payloads/configuration_attribute.c
+++ b/src/libcharon/encoding/payloads/configuration_attribute.c
@@ -1,5 +1,10 @@
/*
+<<<<<<< HEAD
* Copyright (C) 2005-2009 Martin Willi
+=======
+ * Copyright (C) 2005-2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+>>>>>>> upstream/4.5.1
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
@@ -22,20 +27,37 @@
#include <library.h>
#include <daemon.h>
+<<<<<<< HEAD
+=======
+>>>>>>> upstream/4.5.1
typedef struct private_configuration_attribute_t private_configuration_attribute_t;
/**
* Private data of an configuration_attribute_t object.
+<<<<<<< HEAD
*
*/
struct private_configuration_attribute_t {
+=======
+ */
+struct private_configuration_attribute_t {
+
+>>>>>>> upstream/4.5.1
/**
* Public configuration_attribute_t interface.
*/
configuration_attribute_t public;
/**
+<<<<<<< HEAD
+=======
+ * Reserved bit
+ */
+ bool reserved;
+
+ /**
+>>>>>>> upstream/4.5.1
* Type of the attribute.
*/
u_int16_t type;
@@ -58,8 +80,13 @@ struct private_configuration_attribute_t {
* private_configuration_attribute_t.
*/
encoding_rule_t configuration_attribute_encodings[] = {
+<<<<<<< HEAD
{ RESERVED_BIT, 0 },
+=======
+ /* 1 reserved bit */
+ { RESERVED_BIT, offsetof(private_configuration_attribute_t, reserved)},
+>>>>>>> upstream/4.5.1
/* type of the attribute as 15 bit unsigned integer */
{ ATTRIBUTE_TYPE, offsetof(private_configuration_attribute_t, type) },
/* Length of attribute value */
@@ -80,10 +107,15 @@ encoding_rule_t configuration_attribute_encodings[] = {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
+<<<<<<< HEAD
/**
* Implementation of payload_t.verify.
*/
static status_t verify(private_configuration_attribute_t *this)
+=======
+METHOD(payload_t, verify, status_t,
+ private_configuration_attribute_t *this)
+>>>>>>> upstream/4.5.1
{
bool failed = FALSE;
@@ -151,6 +183,7 @@ static status_t verify(private_configuration_attribute_t *this)
return SUCCESS;
}
+<<<<<<< HEAD
/**
* Implementation of payload_t.get_encoding_rules.
*/
@@ -165,18 +198,36 @@ static void get_encoding_rules(private_configuration_attribute_t *this,
* Implementation of payload_t.get_type.
*/
static payload_type_t get_type(private_configuration_attribute_t *this)
+=======
+METHOD(payload_t, get_encoding_rules, void,
+ private_configuration_attribute_t *this, encoding_rule_t **rules,
+ size_t *rule_count)
+{
+ *rules = configuration_attribute_encodings;
+ *rule_count = countof(configuration_attribute_encodings);
+}
+
+METHOD(payload_t, get_type, payload_type_t,
+ private_configuration_attribute_t *this)
+>>>>>>> upstream/4.5.1
{
return CONFIGURATION_ATTRIBUTE;
}
+<<<<<<< HEAD
/**
* Implementation of payload_t.get_next_type.
*/
static payload_type_t get_next_type(private_configuration_attribute_t *this)
+=======
+METHOD(payload_t, get_next_type, payload_type_t,
+ private_configuration_attribute_t *this)
+>>>>>>> upstream/4.5.1
{
return NO_PAYLOAD;
}
+<<<<<<< HEAD
/**
* Implementation of payload_t.set_next_type.
*/
@@ -189,31 +240,55 @@ static void set_next_type(private_configuration_attribute_t *this,
* Implementation of configuration_attribute_t.get_length.
*/
static size_t get_length(private_configuration_attribute_t *this)
+=======
+METHOD(payload_t, set_next_type, void,
+ private_configuration_attribute_t *this, payload_type_t type)
+{
+}
+
+METHOD(payload_t, get_length, size_t,
+ private_configuration_attribute_t *this)
+>>>>>>> upstream/4.5.1
{
return this->value.len + CONFIGURATION_ATTRIBUTE_HEADER_LENGTH;
}
+<<<<<<< HEAD
/**
* Implementation of configuration_attribute_t.get_type.
*/
static configuration_attribute_type_t get_configuration_attribute_type(
private_configuration_attribute_t *this)
+=======
+METHOD(configuration_attribute_t, get_cattr_type, configuration_attribute_type_t,
+ private_configuration_attribute_t *this)
+>>>>>>> upstream/4.5.1
{
return this->type;
}
+<<<<<<< HEAD
/**
* Implementation of configuration_attribute_t.get_value.
*/
static chunk_t get_value(private_configuration_attribute_t *this)
+=======
+METHOD(configuration_attribute_t, get_value, chunk_t,
+ private_configuration_attribute_t *this)
+>>>>>>> upstream/4.5.1
{
return this->value;
}
+<<<<<<< HEAD
/**
* Implementation of configuration_attribute_t.destroy and payload_t.destroy.
*/
static void destroy(private_configuration_attribute_t *this)
+=======
+METHOD2(payload_t, configuration_attribute_t, destroy, void,
+ private_configuration_attribute_t *this)
+>>>>>>> upstream/4.5.1
{
free(this->value.ptr);
free(this);
@@ -226,6 +301,7 @@ configuration_attribute_t *configuration_attribute_create()
{
private_configuration_attribute_t *this;
+<<<<<<< HEAD
this = malloc_thing(private_configuration_attribute_t);
this->public.payload_interface.verify = (status_t(*)(payload_t *))verify;
this->public.payload_interface.get_encoding_rules = (void(*)(payload_t *, encoding_rule_t **, size_t *) )get_encoding_rules;
@@ -243,6 +319,24 @@ configuration_attribute_t *configuration_attribute_create()
this->value = chunk_empty;
this->length = 0;
+=======
+ INIT(this,
+ .public = {
+ .payload_interface = {
+ .verify = _verify,
+ .get_encoding_rules = _get_encoding_rules,
+ .get_length = _get_length,
+ .get_next_type = _get_next_type,
+ .set_next_type = _set_next_type,
+ .get_type = _get_type,
+ .destroy = _destroy,
+ },
+ .get_value = _get_value,
+ .get_type = _get_cattr_type,
+ .destroy = _destroy,
+ },
+ );
+>>>>>>> upstream/4.5.1
return &this->public;
}