aboutsummaryrefslogtreecommitdiffstats
path: root/src/libsimaka/simaka_message.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2017-05-12 12:10:27 +0200
committerTobias Brunner <tobias@strongswan.org>2017-05-26 13:56:44 +0200
commit525cc46cabe3dbf17d9f63e76ea9aa974d3665fa (patch)
tree33c09810e1c86a943c9bbca05ad35900d086362b /src/libsimaka/simaka_message.c
parent95a63bf2813cd6ecad912237688526bbcc3481ee (diff)
downloadstrongswan-525cc46cabe3dbf17d9f63e76ea9aa974d3665fa.tar.bz2
strongswan-525cc46cabe3dbf17d9f63e76ea9aa974d3665fa.tar.xz
Change interface for enumerator_create_filter() callback
This avoids the unportable 5 pointer hack, but requires enumerating in the callback.
Diffstat (limited to 'src/libsimaka/simaka_message.c')
-rw-r--r--src/libsimaka/simaka_message.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/libsimaka/simaka_message.c b/src/libsimaka/simaka_message.c
index 234d7ef2a..6827c1795 100644
--- a/src/libsimaka/simaka_message.c
+++ b/src/libsimaka/simaka_message.c
@@ -222,17 +222,22 @@ METHOD(simaka_message_t, get_type, eap_type_t,
return this->hdr->type;
}
-/**
- * convert attr_t to type and data enumeration
- */
-static bool attr_enum_filter(void *null, attr_t **in, simaka_attribute_t *type,
- void *dummy, chunk_t *data)
+CALLBACK(attr_enum_filter, bool,
+ void *null, enumerator_t *orig, va_list args)
{
- attr_t *attr = *in;
+ attr_t *attr;
+ simaka_attribute_t *type;
+ chunk_t *data;
- *type = attr->type;
- *data = chunk_create(attr->data, attr->len);
- return TRUE;
+ VA_ARGS_VGET(args, type, data);
+
+ if (orig->enumerate(orig, &attr))
+ {
+ *type = attr->type;
+ *data = chunk_create(attr->data, attr->len);
+ return TRUE;
+ }
+ return FALSE;
}
METHOD(simaka_message_t, create_attribute_enumerator, enumerator_t*,
@@ -240,7 +245,7 @@ METHOD(simaka_message_t, create_attribute_enumerator, enumerator_t*,
{
return enumerator_create_filter(
this->attributes->create_enumerator(this->attributes),
- (void*)attr_enum_filter, NULL, NULL);
+ attr_enum_filter, NULL, NULL);
}
METHOD(simaka_message_t, add_attribute, void,