diff options
author | Martin Willi <martin@revosec.ch> | 2011-11-17 11:27:46 +0000 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:30:42 +0100 |
commit | 38fb67fbf18489f40845b072e4ed50b1f6cf0c9c (patch) | |
tree | 01e3e43880ec5cf7712607bfd37a6811cbb4cbce /src/libcharon/encoding/payloads/transform_substructure.c | |
parent | e9b55b832546d05f464bdddbe779ed21cd17b624 (diff) | |
download | strongswan-38fb67fbf18489f40845b072e4ed50b1f6cf0c9c.tar.bz2 strongswan-38fb67fbf18489f40845b072e4ed50b1f6cf0c9c.tar.xz |
Add a payload.get_header_length() method, remove header length definitions
Diffstat (limited to 'src/libcharon/encoding/payloads/transform_substructure.c')
-rw-r--r-- | src/libcharon/encoding/payloads/transform_substructure.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libcharon/encoding/payloads/transform_substructure.c b/src/libcharon/encoding/payloads/transform_substructure.c index da022ca75..63464e9f3 100644 --- a/src/libcharon/encoding/payloads/transform_substructure.c +++ b/src/libcharon/encoding/payloads/transform_substructure.c @@ -174,6 +174,12 @@ METHOD(payload_t, get_encoding_rules, int, return countof(encodings_v1); } +METHOD(payload_t, get_header_length, int, + private_transform_substructure_t *this) +{ + return 8; +} + METHOD(payload_t, get_type, payload_type_t, private_transform_substructure_t *this) { @@ -194,7 +200,7 @@ static void compute_length(private_transform_substructure_t *this) enumerator_t *enumerator; payload_t *attribute; - this->transform_length = TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH; + this->transform_length = get_header_length(this); enumerator = this->attributes->create_enumerator(this->attributes); while (enumerator->enumerate(enumerator, &attribute)) { @@ -269,6 +275,7 @@ transform_substructure_t *transform_substructure_create(payload_type_t type) .payload_interface = { .verify = _verify, .get_encoding_rules = _get_encoding_rules, + .get_header_length = _get_header_length, .get_length = _get_length, .get_next_type = _get_next_type, .set_next_type = _set_next_type, @@ -283,7 +290,7 @@ transform_substructure_t *transform_substructure_create(payload_type_t type) .destroy = _destroy, }, .next_payload = NO_PAYLOAD, - .transform_length = TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH, + .transform_length = get_header_length(this), .attributes = linked_list_create(), .type = type, ); |