Migrate all enumerators to venumerate() interface change
This commit is contained in:
@@ -118,11 +118,12 @@ static u_int create_rekey(char *string)
|
||||
}
|
||||
|
||||
METHOD(enumerator_t, peer_enumerator_enumerate, bool,
|
||||
peer_enumerator_t *this, peer_cfg_t **cfg)
|
||||
peer_enumerator_t *this, va_list args)
|
||||
{
|
||||
char *name, *ike_proposal, *esp_proposal, *ike_rekey, *esp_rekey;
|
||||
char *local_id, *local_addr, *local_net;
|
||||
char *remote_id, *remote_addr, *remote_net;
|
||||
peer_cfg_t **cfg;
|
||||
child_cfg_t *child_cfg;
|
||||
ike_cfg_t *ike_cfg;
|
||||
auth_cfg_t *auth;
|
||||
@@ -145,6 +146,8 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
|
||||
.mode = MODE_TUNNEL,
|
||||
};
|
||||
|
||||
VA_ARGS_VGET(args, cfg);
|
||||
|
||||
/* defaults */
|
||||
name = "unnamed";
|
||||
local_id = NULL;
|
||||
@@ -212,7 +215,8 @@ METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
|
||||
|
||||
INIT(e,
|
||||
.public = {
|
||||
.enumerate = (void*)_peer_enumerator_enumerate,
|
||||
.enumerate = enumerator_enumerate_default,
|
||||
.venumerate = _peer_enumerator_enumerate,
|
||||
.destroy = _peer_enumerator_destroy,
|
||||
},
|
||||
.inner = this->parser->create_section_enumerator(this->parser,
|
||||
@@ -241,10 +245,13 @@ typedef struct {
|
||||
} ike_enumerator_t;
|
||||
|
||||
METHOD(enumerator_t, ike_enumerator_enumerate, bool,
|
||||
ike_enumerator_t *this, ike_cfg_t **cfg)
|
||||
ike_enumerator_t *this, va_list args)
|
||||
{
|
||||
ike_cfg_t **cfg;
|
||||
char *local_addr, *remote_addr, *ike_proposal;
|
||||
|
||||
VA_ARGS_VGET(args, cfg);
|
||||
|
||||
/* defaults */
|
||||
local_addr = "0.0.0.0";
|
||||
remote_addr = "0.0.0.0";
|
||||
@@ -282,7 +289,8 @@ METHOD(backend_t, create_ike_cfg_enumerator, enumerator_t*,
|
||||
|
||||
INIT(e,
|
||||
.public = {
|
||||
.enumerate = (void*)_ike_enumerator_enumerate,
|
||||
.enumerate = enumerator_enumerate_default,
|
||||
.venumerate = _ike_enumerator_enumerate,
|
||||
.destroy = _ike_enumerator_destroy,
|
||||
},
|
||||
.inner = this->parser->create_section_enumerator(this->parser,
|
||||
|
||||
@@ -52,12 +52,15 @@ typedef struct {
|
||||
} shared_enumerator_t;
|
||||
|
||||
METHOD(enumerator_t, shared_enumerator_enumerate, bool,
|
||||
shared_enumerator_t *this, shared_key_t **key, id_match_t *me,
|
||||
id_match_t *other)
|
||||
shared_enumerator_t *this, va_list args)
|
||||
{
|
||||
shared_key_t **key;
|
||||
id_match_t *me, *other;
|
||||
char *local_id, *remote_id, *psk;
|
||||
identification_t *local, *remote;
|
||||
|
||||
VA_ARGS_VGET(args, key, me, other);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
/* defaults */
|
||||
@@ -126,7 +129,8 @@ METHOD(credential_set_t, create_shared_enumerator, enumerator_t*,
|
||||
|
||||
INIT(e,
|
||||
.public = {
|
||||
.enumerate = (void*)_shared_enumerator_enumerate,
|
||||
.enumerate = enumerator_enumerate_default,
|
||||
.venumerate = _shared_enumerator_enumerate,
|
||||
.destroy = _shared_enumerator_destroy,
|
||||
},
|
||||
.me = me,
|
||||
|
||||
@@ -58,11 +58,10 @@ typedef struct {
|
||||
} section_enumerator_t;
|
||||
|
||||
METHOD(enumerator_t, section_enumerator_enumerate, bool,
|
||||
section_enumerator_t *this, ...)
|
||||
section_enumerator_t *this, va_list args)
|
||||
{
|
||||
struct uci_element *element;
|
||||
char **value;
|
||||
va_list args;
|
||||
int i;
|
||||
|
||||
if (&this->current->list == this->list)
|
||||
@@ -70,8 +69,6 @@ METHOD(enumerator_t, section_enumerator_enumerate, bool,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
va_start(args, this);
|
||||
|
||||
value = va_arg(args, char**);
|
||||
if (value)
|
||||
{
|
||||
@@ -96,7 +93,6 @@ METHOD(enumerator_t, section_enumerator_enumerate, bool,
|
||||
*value = uci_to_option(element)->value;
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
this->current = list_to_element(this->current->list.next);
|
||||
return TRUE;
|
||||
@@ -124,7 +120,13 @@ METHOD(uci_parser_t, create_section_enumerator, enumerator_t*,
|
||||
i++;
|
||||
}
|
||||
va_end(args);
|
||||
e = malloc(sizeof(section_enumerator_t) + sizeof(char*) * i);
|
||||
INIT_EXTRA(e, sizeof(char*) * i,
|
||||
.public = {
|
||||
.enumerate = enumerator_enumerate_default,
|
||||
.venumerate = _section_enumerator_enumerate,
|
||||
.destroy = _section_enumerator_destroy,
|
||||
},
|
||||
);
|
||||
i = 0;
|
||||
va_start(args, this);
|
||||
do
|
||||
@@ -134,9 +136,6 @@ METHOD(uci_parser_t, create_section_enumerator, enumerator_t*,
|
||||
while (e->keywords[i++]);
|
||||
va_end(args);
|
||||
|
||||
e->public.enumerate = (void*)_section_enumerator_enumerate;
|
||||
e->public.destroy = _section_enumerator_destroy;
|
||||
|
||||
/* load uci context */
|
||||
e->ctx = uci_alloc_context();
|
||||
if (uci_load(e->ctx, this->package, &e->package) != UCI_OK)
|
||||
|
||||
Reference in New Issue
Block a user