Migrated medsrv_config_t to INIT/METHOD macros.
This commit is contained in:
@@ -52,29 +52,21 @@ struct private_medsrv_config_t {
|
|||||||
ike_cfg_t *ike;
|
ike_cfg_t *ike;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
|
||||||
* implements backend_t.get_peer_cfg_by_name.
|
private_medsrv_config_t *this, char *name)
|
||||||
*/
|
|
||||||
static peer_cfg_t *get_peer_cfg_by_name(private_medsrv_config_t *this, char *name)
|
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(backend_t, create_ike_cfg_enumerator, enumerator_t*,
|
||||||
* Implementation of backend_t.create_ike_cfg_enumerator.
|
private_medsrv_config_t *this, host_t *me, host_t *other)
|
||||||
*/
|
|
||||||
static enumerator_t* create_ike_cfg_enumerator(private_medsrv_config_t *this,
|
|
||||||
host_t *me, host_t *other)
|
|
||||||
{
|
{
|
||||||
return enumerator_create_single(this->ike, NULL);
|
return enumerator_create_single(this->ike, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
|
||||||
* Implementation of backend_t.create_peer_cfg_enumerator.
|
private_medsrv_config_t *this, identification_t *me,
|
||||||
*/
|
identification_t *other)
|
||||||
static enumerator_t* create_peer_cfg_enumerator(private_medsrv_config_t *this,
|
|
||||||
identification_t *me,
|
|
||||||
identification_t *other)
|
|
||||||
{
|
{
|
||||||
enumerator_t *e;
|
enumerator_t *e;
|
||||||
|
|
||||||
@@ -98,11 +90,11 @@ static enumerator_t* create_peer_cfg_enumerator(private_medsrv_config_t *this,
|
|||||||
peer_cfg = peer_cfg_create(
|
peer_cfg = peer_cfg_create(
|
||||||
name, 2, this->ike->get_ref(this->ike),
|
name, 2, this->ike->get_ref(this->ike),
|
||||||
CERT_NEVER_SEND, UNIQUE_REPLACE,
|
CERT_NEVER_SEND, UNIQUE_REPLACE,
|
||||||
1, this->rekey*60, 0, /* keytries, rekey, reauth */
|
1, this->rekey*60, 0, /* keytries, rekey, reauth */
|
||||||
this->rekey*5, this->rekey*3, /* jitter, overtime */
|
this->rekey*5, this->rekey*3, /* jitter, overtime */
|
||||||
TRUE, this->dpd, /* mobike, dpddelay */
|
TRUE, this->dpd, /* mobike, dpddelay */
|
||||||
NULL, NULL, /* vip, pool */
|
NULL, NULL, /* vip, pool */
|
||||||
TRUE, NULL, NULL); /* mediation, med by, peer id */
|
TRUE, NULL, NULL); /* mediation, med by, peer id */
|
||||||
e->destroy(e);
|
e->destroy(e);
|
||||||
|
|
||||||
auth = auth_cfg_create();
|
auth = auth_cfg_create();
|
||||||
@@ -121,10 +113,8 @@ static enumerator_t* create_peer_cfg_enumerator(private_medsrv_config_t *this,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(medsrv_config_t, destroy, void,
|
||||||
* Implementation of medsrv_config_t.destroy.
|
private_medsrv_config_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_medsrv_config_t *this)
|
|
||||||
{
|
{
|
||||||
this->ike->destroy(this->ike);
|
this->ike->destroy(this->ike);
|
||||||
free(this);
|
free(this);
|
||||||
@@ -135,18 +125,23 @@ static void destroy(private_medsrv_config_t *this)
|
|||||||
*/
|
*/
|
||||||
medsrv_config_t *medsrv_config_create(database_t *db)
|
medsrv_config_t *medsrv_config_create(database_t *db)
|
||||||
{
|
{
|
||||||
private_medsrv_config_t *this = malloc_thing(private_medsrv_config_t);
|
private_medsrv_config_t *this;
|
||||||
|
|
||||||
this->public.backend.create_peer_cfg_enumerator = (enumerator_t*(*)(backend_t*, identification_t *me, identification_t *other))create_peer_cfg_enumerator;
|
INIT(this,
|
||||||
this->public.backend.create_ike_cfg_enumerator = (enumerator_t*(*)(backend_t*, host_t *me, host_t *other))create_ike_cfg_enumerator;
|
.public = {
|
||||||
this->public.backend.get_peer_cfg_by_name = (peer_cfg_t* (*)(backend_t*,char*))get_peer_cfg_by_name;
|
.backend = {
|
||||||
this->public.destroy = (void(*)(medsrv_config_t*))destroy;
|
.create_peer_cfg_enumerator = _create_peer_cfg_enumerator,
|
||||||
|
.create_ike_cfg_enumerator = _create_ike_cfg_enumerator,
|
||||||
this->db = db;
|
.get_peer_cfg_by_name = _get_peer_cfg_by_name,
|
||||||
this->rekey = lib->settings->get_time(lib->settings, "medsrv.rekey", 1200);
|
},
|
||||||
this->dpd = lib->settings->get_time(lib->settings, "medsrv.dpd", 300);
|
.destroy = _destroy,
|
||||||
this->ike = ike_cfg_create(FALSE, FALSE,
|
},
|
||||||
"0.0.0.0", IKEV2_UDP_PORT, "0.0.0.0", IKEV2_UDP_PORT);
|
.db = db,
|
||||||
|
.rekey = lib->settings->get_time(lib->settings, "medsrv.rekey", 1200),
|
||||||
|
.dpd = lib->settings->get_time(lib->settings, "medsrv.dpd", 300),
|
||||||
|
.ike = ike_cfg_create(FALSE, FALSE,
|
||||||
|
"0.0.0.0", IKEV2_UDP_PORT, "0.0.0.0", IKEV2_UDP_PORT),
|
||||||
|
);
|
||||||
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
this->ike->add_proposal(this->ike, proposal_create_default(PROTO_IKE));
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
|
|||||||
Reference in New Issue
Block a user