ike-cfg: Pass arguments as struct

This commit is contained in:
Tobias Brunner
2019-04-25 14:31:33 +02:00
parent de77957eda
commit 9486a2e5b0
18 changed files with 253 additions and 153 deletions
+8 -2
View File
@@ -19,11 +19,17 @@
static void assert_family(int expected, char *addr, bool local)
{
ike_cfg_create_t ike = {
.version = IKEV2,
.local = local ? addr : "%any",
.local_port = 500,
.remote = local ? "%any" : addr,
.remote_port = 500,
};
ike_cfg_t *cfg;
int family;
cfg = ike_cfg_create(IKEV2, FALSE, FALSE, local ? addr : "%any", 500,
local ? "%any" : addr, 500, FRAGMENTATION_NO, 0);
cfg = ike_cfg_create(&ike);
family = ike_cfg_get_family(cfg, local);
ck_assert_msg(expected == family, "expected family %d != %d (addr: '%s')",
expected, family, addr);
+8 -2
View File
@@ -23,8 +23,14 @@
*/
static ike_cfg_t *create_ike_cfg()
{
return ike_cfg_create(IKEV2, TRUE, FALSE, "127.0.0.1", 500,
"127.0.0.1", 500, FRAGMENTATION_NO, 0);
ike_cfg_create_t ike = {
.version = IKEV2,
.local = "127.0.0.1",
.local_port = 500,
.remote = "127.0.0.1",
.remote_port = 500,
};
return ike_cfg_create(&ike);
}
/**
@@ -85,11 +85,17 @@ exchange_test_helper_t *exchange_test_helper;
static ike_cfg_t *create_ike_cfg(bool initiator, exchange_test_sa_conf_t *conf)
{
ike_cfg_create_t ike = {
.version = IKEV2,
.local = "127.0.0.1",
.local_port = IKEV2_UDP_PORT,
.remote = "127.0.0.1",
.remote_port = IKEV2_UDP_PORT,
};
ike_cfg_t *ike_cfg;
char *proposal = NULL;
ike_cfg = ike_cfg_create(IKEV2, TRUE, FALSE, "127.0.0.1", IKEV2_UDP_PORT,
"127.0.0.1", IKEV2_UDP_PORT, FRAGMENTATION_NO, 0);
ike_cfg = ike_cfg_create(&ike);
if (conf)
{
proposal = initiator ? conf->initiator.ike : conf->responder.ike;