diff options
author | Tobias Brunner <tobias@strongswan.org> | 2017-05-12 12:10:27 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2017-05-26 13:56:44 +0200 |
commit | 525cc46cabe3dbf17d9f63e76ea9aa974d3665fa (patch) | |
tree | 33c09810e1c86a943c9bbca05ad35900d086362b /src/libcharon/plugins/dhcp/dhcp_transaction.c | |
parent | 95a63bf2813cd6ecad912237688526bbcc3481ee (diff) | |
download | strongswan-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/libcharon/plugins/dhcp/dhcp_transaction.c')
-rw-r--r-- | src/libcharon/plugins/dhcp/dhcp_transaction.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/libcharon/plugins/dhcp/dhcp_transaction.c b/src/libcharon/plugins/dhcp/dhcp_transaction.c index 3ee88a698..87711799c 100644 --- a/src/libcharon/plugins/dhcp/dhcp_transaction.c +++ b/src/libcharon/plugins/dhcp/dhcp_transaction.c @@ -114,16 +114,22 @@ METHOD(dhcp_transaction_t, add_attribute, void, this->attributes->insert_last(this->attributes, entry); } -/** - * Filter function to map entries to type/data - */ -static bool attribute_filter(void *null, attribute_entry_t **entry, - configuration_attribute_type_t *type, - void **dummy, chunk_t *data) +CALLBACK(attribute_filter, bool, + void *null, enumerator_t *orig, va_list args) { - *type = (*entry)->type; - *data = (*entry)->data; - return TRUE; + configuration_attribute_type_t *type; + attribute_entry_t *entry; + chunk_t *data; + + VA_ARGS_VGET(args, type, data); + + if (orig->enumerate(orig, &entry)) + { + *type = entry->type; + *data = entry->data; + return TRUE; + } + return FALSE; } METHOD(dhcp_transaction_t, create_attribute_enumerator, enumerator_t*, @@ -131,7 +137,7 @@ METHOD(dhcp_transaction_t, create_attribute_enumerator, enumerator_t*, { return enumerator_create_filter( this->attributes->create_enumerator(this->attributes), - (void*)attribute_filter, NULL, NULL); + attribute_filter, NULL, NULL); } /** |