Change interface for enumerator_create_filter() callback
This avoids the unportable 5 pointer hack, but requires enumerating in the callback.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user