aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/encoding/payloads/configuration_attribute.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-11-17 11:27:46 +0000
committerMartin Willi <martin@revosec.ch>2012-03-20 17:30:42 +0100
commit38fb67fbf18489f40845b072e4ed50b1f6cf0c9c (patch)
tree01e3e43880ec5cf7712607bfd37a6811cbb4cbce /src/libcharon/encoding/payloads/configuration_attribute.c
parente9b55b832546d05f464bdddbe779ed21cd17b624 (diff)
downloadstrongswan-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/configuration_attribute.c')
-rw-r--r--src/libcharon/encoding/payloads/configuration_attribute.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcharon/encoding/payloads/configuration_attribute.c b/src/libcharon/encoding/payloads/configuration_attribute.c
index a657ef13a..8746b9b9e 100644
--- a/src/libcharon/encoding/payloads/configuration_attribute.c
+++ b/src/libcharon/encoding/payloads/configuration_attribute.c
@@ -161,6 +161,12 @@ METHOD(payload_t, get_encoding_rules, int,
return countof(encodings);
}
+METHOD(payload_t, get_header_length, int,
+ private_configuration_attribute_t *this)
+{
+ return 4;
+}
+
METHOD(payload_t, get_type, payload_type_t,
private_configuration_attribute_t *this)
{
@@ -181,7 +187,7 @@ METHOD(payload_t, set_next_type, void,
METHOD(payload_t, get_length, size_t,
private_configuration_attribute_t *this)
{
- return this->value.len + CONFIGURATION_ATTRIBUTE_HEADER_LENGTH;
+ return get_header_length(this) + this->value.len;
}
METHOD(configuration_attribute_t, get_cattr_type, configuration_attribute_type_t,
@@ -215,6 +221,7 @@ configuration_attribute_t *configuration_attribute_create()
.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,