summaryrefslogtreecommitdiff
path: root/src/libcharon/encoding/payloads/vendor_id_payload.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/encoding/payloads/vendor_id_payload.c')
-rw-r--r--src/libcharon/encoding/payloads/vendor_id_payload.c106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/libcharon/encoding/payloads/vendor_id_payload.c b/src/libcharon/encoding/payloads/vendor_id_payload.c
index bf33d2418..d2295e4a2 100644
--- a/src/libcharon/encoding/payloads/vendor_id_payload.c
+++ b/src/libcharon/encoding/payloads/vendor_id_payload.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
*
@@ -41,6 +46,14 @@ struct private_vendor_id_payload_t {
bool critical;
/**
+<<<<<<< HEAD
+=======
+ * Reserved bits
+ */
+ bool reserved[7];
+
+ /**
+>>>>>>> upstream/4.5.1
* Length of this payload.
*/
u_int16_t payload_length;
@@ -59,6 +72,7 @@ struct private_vendor_id_payload_t {
*/
encoding_rule_t vendor_id_payload_encodings[] = {
/* 1 Byte next payload type, stored in the field next_payload */
+<<<<<<< HEAD
{ U_INT_8, offsetof(private_vendor_id_payload_t, next_payload) },
/* the critical bit */
{ FLAG, offsetof(private_vendor_id_payload_t, critical) },
@@ -74,6 +88,23 @@ encoding_rule_t vendor_id_payload_encodings[] = {
{ PAYLOAD_LENGTH, offsetof(private_vendor_id_payload_t, payload_length)},
/* some vendor_id data bytes, length is defined in PAYLOAD_LENGTH */
{ VID_DATA, offsetof(private_vendor_id_payload_t, data) }
+=======
+ { U_INT_8, offsetof(private_vendor_id_payload_t, next_payload) },
+ /* the critical bit */
+ { FLAG, offsetof(private_vendor_id_payload_t, critical) },
+ /* 7 Bit reserved bits, nowhere stored */
+ { RESERVED_BIT, offsetof(private_vendor_id_payload_t, reserved[0]) },
+ { RESERVED_BIT, offsetof(private_vendor_id_payload_t, reserved[1]) },
+ { RESERVED_BIT, offsetof(private_vendor_id_payload_t, reserved[2]) },
+ { RESERVED_BIT, offsetof(private_vendor_id_payload_t, reserved[3]) },
+ { RESERVED_BIT, offsetof(private_vendor_id_payload_t, reserved[4]) },
+ { RESERVED_BIT, offsetof(private_vendor_id_payload_t, reserved[5]) },
+ { RESERVED_BIT, offsetof(private_vendor_id_payload_t, reserved[6]) },
+ /* Length of the whole payload*/
+ { PAYLOAD_LENGTH, offsetof(private_vendor_id_payload_t, payload_length)},
+ /* some vendor_id data bytes, length is defined in PAYLOAD_LENGTH */
+ { VID_DATA, offsetof(private_vendor_id_payload_t, data) }
+>>>>>>> upstream/4.5.1
};
/*
@@ -88,14 +119,20 @@ encoding_rule_t vendor_id_payload_encodings[] = {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
+<<<<<<< HEAD
/**
* Implementation of payload_t.verify.
*/
static status_t verify(private_vendor_id_payload_t *this)
+=======
+METHOD(payload_t, verify, status_t,
+ private_vendor_id_payload_t *this)
+>>>>>>> upstream/4.5.1
{
return SUCCESS;
}
+<<<<<<< HEAD
/**
* Implementation of vendor_id_payload_t.get_encoding_rules.
*/
@@ -110,46 +147,83 @@ static void get_encoding_rules(private_vendor_id_payload_t *this,
* Implementation of payload_t.get_type.
*/
static payload_type_t get_payload_type(private_vendor_id_payload_t *this)
+=======
+METHOD(payload_t, get_encoding_rules, void,
+ private_vendor_id_payload_t *this, encoding_rule_t **rules,
+ size_t *rule_count)
+{
+ *rules = vendor_id_payload_encodings;
+ *rule_count = countof(vendor_id_payload_encodings);
+}
+
+METHOD(payload_t, get_type, payload_type_t,
+ private_vendor_id_payload_t *this)
+>>>>>>> upstream/4.5.1
{
return VENDOR_ID;
}
+<<<<<<< HEAD
/**
* Implementation of payload_t.get_next_type.
*/
static payload_type_t get_next_type(private_vendor_id_payload_t *this)
+=======
+METHOD(payload_t, get_next_type, payload_type_t,
+ private_vendor_id_payload_t *this)
+>>>>>>> upstream/4.5.1
{
return this->next_payload;
}
+<<<<<<< HEAD
/**
* Implementation of payload_t.set_next_type.
*/
static void set_next_type(private_vendor_id_payload_t *this,payload_type_t type)
+=======
+METHOD(payload_t, set_next_type, void,
+ private_vendor_id_payload_t *this, payload_type_t type)
+>>>>>>> upstream/4.5.1
{
this->next_payload = type;
}
+<<<<<<< HEAD
/**
* Implementation of payload_t.get_length.
*/
static size_t get_length(private_vendor_id_payload_t *this)
+=======
+METHOD(payload_t, get_length, size_t,
+ private_vendor_id_payload_t *this)
+>>>>>>> upstream/4.5.1
{
return this->payload_length;
}
+<<<<<<< HEAD
/**
* Implementation of vendor_id_payload_t.get_data.
*/
static chunk_t get_data(private_vendor_id_payload_t *this)
+=======
+METHOD(vendor_id_payload_t, get_data, chunk_t,
+ private_vendor_id_payload_t *this)
+>>>>>>> upstream/4.5.1
{
return this->data;
}
+<<<<<<< HEAD
/**
* Implementation of payload_t.destroy and vendor_id_payload_t.destroy.
*/
static void destroy(private_vendor_id_payload_t *this)
+=======
+METHOD2(payload_t, vendor_id_payload_t, destroy, void,
+ private_vendor_id_payload_t *this)
+>>>>>>> upstream/4.5.1
{
free(this->data.ptr);
free(this);
@@ -158,6 +232,7 @@ static void destroy(private_vendor_id_payload_t *this)
/*
* Described in header
*/
+<<<<<<< HEAD
vendor_id_payload_t *vendor_id_payload_create()
{
private_vendor_id_payload_t *this = malloc_thing(private_vendor_id_payload_t);
@@ -176,12 +251,37 @@ vendor_id_payload_t *vendor_id_payload_create()
this->payload_length = VENDOR_ID_PAYLOAD_HEADER_LENGTH;
this->data = chunk_empty;
+=======
+vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data)
+{
+ private_vendor_id_payload_t *this;
+
+ 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_data = _get_data,
+ .destroy = _destroy,
+ },
+ .next_payload = NO_PAYLOAD,
+ .payload_length = VENDOR_ID_PAYLOAD_HEADER_LENGTH + data.len,
+ .data = data,
+ );
+>>>>>>> upstream/4.5.1
return &this->public;
}
/*
* Described in header
*/
+<<<<<<< HEAD
vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data)
{
private_vendor_id_payload_t *this;
@@ -193,3 +293,9 @@ vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data)
return &this->public;
}
+=======
+vendor_id_payload_t *vendor_id_payload_create()
+{
+ return vendor_id_payload_create_data(chunk_empty);
+}
+>>>>>>> upstream/4.5.1