aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/unity/unity_handler.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/libcharon/plugins/unity/unity_handler.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/libcharon/plugins/unity/unity_handler.c')
-rw-r--r--src/libcharon/plugins/unity/unity_handler.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/libcharon/plugins/unity/unity_handler.c b/src/libcharon/plugins/unity/unity_handler.c
index f640f9fbb..4a1478c6d 100644
--- a/src/libcharon/plugins/unity/unity_handler.c
+++ b/src/libcharon/plugins/unity/unity_handler.c
@@ -411,24 +411,27 @@ typedef struct {
ike_sa_id_t *id;
} include_filter_t;
-/**
- * Include enumerator filter function
- */
-static bool include_filter(include_filter_t *data,
- entry_t **entry, traffic_selector_t **ts)
+CALLBACK(include_filter, bool,
+ include_filter_t *data, enumerator_t *orig, va_list args)
{
- if (data->id->equals(data->id, (*entry)->id))
+ entry_t *entry;
+ traffic_selector_t **ts;
+
+ VA_ARGS_VGET(args, ts);
+
+ while (orig->enumerate(orig, &entry))
{
- *ts = (*entry)->ts;
- return TRUE;
+ if (data->id->equals(data->id, entry->id))
+ {
+ *ts = entry->ts;
+ return TRUE;
+ }
}
return FALSE;
}
-/**
- * Destroy include filter data, unlock mutex
- */
-static void destroy_filter(include_filter_t *data)
+CALLBACK(destroy_filter, void,
+ include_filter_t *data)
{
data->mutex->unlock(data->mutex);
free(data);
@@ -446,7 +449,7 @@ METHOD(unity_handler_t, create_include_enumerator, enumerator_t*,
data->mutex->lock(data->mutex);
return enumerator_create_filter(
this->include->create_enumerator(this->include),
- (void*)include_filter, data, (void*)destroy_filter);
+ include_filter, data, destroy_filter);
}
METHOD(unity_handler_t, destroy, void,