summaryrefslogtreecommitdiff
path: root/src/libcharon/encoding/payloads/sa_payload.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/encoding/payloads/sa_payload.c')
-rw-r--r--src/libcharon/encoding/payloads/sa_payload.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/libcharon/encoding/payloads/sa_payload.c b/src/libcharon/encoding/payloads/sa_payload.c
index 4fbd4cac0..db20d052f 100644
--- a/src/libcharon/encoding/payloads/sa_payload.c
+++ b/src/libcharon/encoding/payloads/sa_payload.c
@@ -46,6 +46,11 @@ struct private_sa_payload_t {
bool critical;
/**
+ * Reserved bits
+ */
+ bool reserved[7];
+
+ /**
* Length of this payload.
*/
u_int16_t payload_length;
@@ -68,13 +73,13 @@ encoding_rule_t sa_payload_encodings[] = {
/* the critical bit */
{ FLAG, offsetof(private_sa_payload_t, critical) },
/* 7 Bit reserved bits, nowhere stored */
- { RESERVED_BIT, 0 },
- { RESERVED_BIT, 0 },
- { RESERVED_BIT, 0 },
- { RESERVED_BIT, 0 },
- { RESERVED_BIT, 0 },
- { RESERVED_BIT, 0 },
- { RESERVED_BIT, 0 },
+ { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[0]) },
+ { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[1]) },
+ { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[2]) },
+ { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[3]) },
+ { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[4]) },
+ { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[5]) },
+ { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[6]) },
/* Length of the whole SA payload*/
{ PAYLOAD_LENGTH, offsetof(private_sa_payload_t, payload_length) },
/* Proposals are stored in a proposal substructure,
@@ -185,7 +190,6 @@ static void compute_length(private_sa_payload_t *this)
METHOD(payload_t, get_length, size_t,
private_sa_payload_t *this)
{
- compute_length(this);
return this->payload_length;
}
@@ -258,6 +262,12 @@ METHOD(sa_payload_t, get_proposals, linked_list_t*,
return list;
}
+METHOD(sa_payload_t, create_substructure_enumerator, enumerator_t*,
+ private_sa_payload_t *this)
+{
+ return this->proposals->create_enumerator(this->proposals);
+}
+
METHOD2(payload_t, sa_payload_t, destroy, void,
private_sa_payload_t *this)
{
@@ -286,6 +296,7 @@ sa_payload_t *sa_payload_create()
},
.add_proposal = _add_proposal,
.get_proposals = _get_proposals,
+ .create_substructure_enumerator = _create_substructure_enumerator,
.destroy = _destroy,
},
.next_payload = NO_PAYLOAD,