Migrated stroke_control_t to INIT/METHOD macros
This commit is contained in:
@@ -145,10 +145,8 @@ static void start_all_connections(void)
|
|||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(stroke_control_t, initiate, void,
|
||||||
* Implementation of stroke_control_t.initiate.
|
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
*/
|
|
||||||
static void initiate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
|
||||||
{
|
{
|
||||||
peer_cfg_t *peer_cfg;
|
peer_cfg_t *peer_cfg;
|
||||||
child_cfg_t *child_cfg;
|
child_cfg_t *child_cfg;
|
||||||
@@ -197,9 +195,6 @@ static void initiate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *ou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse a terminate/rekey specifier
|
|
||||||
*/
|
|
||||||
static bool parse_specifier(char *string, u_int32_t *id,
|
static bool parse_specifier(char *string, u_int32_t *id,
|
||||||
char **name, bool *child, bool *all)
|
char **name, bool *child, bool *all)
|
||||||
{
|
{
|
||||||
@@ -264,10 +259,8 @@ static bool parse_specifier(char *string, u_int32_t *id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(stroke_control_t, terminate, void,
|
||||||
* Implementation of stroke_control_t.terminate.
|
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
*/
|
|
||||||
static void terminate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
u_int32_t id;
|
u_int32_t id;
|
||||||
@@ -369,10 +362,8 @@ static void terminate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *o
|
|||||||
child_list->destroy(child_list);
|
child_list->destroy(child_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(stroke_control_t, rekey, void,
|
||||||
* Implementation of stroke_control_t.rekey.
|
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
*/
|
|
||||||
static void rekey(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
u_int32_t id;
|
u_int32_t id;
|
||||||
@@ -431,11 +422,8 @@ static void rekey(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
|||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(stroke_control_t, terminate_srcip, void,
|
||||||
* Implementation of stroke_control_t.terminate_srcip.
|
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
*/
|
|
||||||
static void terminate_srcip(private_stroke_control_t *this,
|
|
||||||
stroke_msg_t *msg, FILE *out)
|
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
@@ -500,10 +488,8 @@ static void terminate_srcip(private_stroke_control_t *this,
|
|||||||
DESTROY_IF(end);
|
DESTROY_IF(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(stroke_control_t, purge_ike, void,
|
||||||
* Implementation of stroke_control_t.purge_ike
|
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
*/
|
|
||||||
static void purge_ike(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
iterator_t *iterator;
|
iterator_t *iterator;
|
||||||
@@ -540,10 +526,8 @@ static void purge_ike(private_stroke_control_t *this, stroke_msg_t *msg, FILE *o
|
|||||||
list->destroy(list);
|
list->destroy(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(stroke_control_t, route, void,
|
||||||
* Implementation of stroke_control_t.route.
|
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
*/
|
|
||||||
static void route(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
|
||||||
{
|
{
|
||||||
peer_cfg_t *peer_cfg;
|
peer_cfg_t *peer_cfg;
|
||||||
child_cfg_t *child_cfg;
|
child_cfg_t *child_cfg;
|
||||||
@@ -581,10 +565,8 @@ static void route(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
|||||||
child_cfg->destroy(child_cfg);
|
child_cfg->destroy(child_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(stroke_control_t, unroute, void,
|
||||||
* Implementation of stroke_control_t.unroute.
|
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
*/
|
|
||||||
static void unroute(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
|
|
||||||
{
|
{
|
||||||
child_sa_t *child_sa;
|
child_sa_t *child_sa;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
@@ -606,10 +588,8 @@ static void unroute(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out
|
|||||||
fprintf(out, "configuration '%s' not found\n", msg->unroute.name);
|
fprintf(out, "configuration '%s' not found\n", msg->unroute.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(stroke_control_t, destroy, void,
|
||||||
* Implementation of stroke_control_t.destroy
|
private_stroke_control_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_stroke_control_t *this)
|
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@@ -619,16 +599,20 @@ static void destroy(private_stroke_control_t *this)
|
|||||||
*/
|
*/
|
||||||
stroke_control_t *stroke_control_create()
|
stroke_control_t *stroke_control_create()
|
||||||
{
|
{
|
||||||
private_stroke_control_t *this = malloc_thing(private_stroke_control_t);
|
private_stroke_control_t *this;
|
||||||
|
|
||||||
this->public.initiate = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))initiate;
|
INIT(this,
|
||||||
this->public.terminate = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))terminate;
|
.public = {
|
||||||
this->public.terminate_srcip = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))terminate_srcip;
|
.initiate = _initiate,
|
||||||
this->public.rekey = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))rekey;
|
.terminate = _terminate,
|
||||||
this->public.purge_ike = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))purge_ike;
|
.terminate_srcip = _terminate_srcip,
|
||||||
this->public.route = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))route;
|
.rekey = _rekey,
|
||||||
this->public.unroute = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))unroute;
|
.purge_ike = _purge_ike,
|
||||||
this->public.destroy = (void(*)(stroke_control_t*))destroy;
|
.route = _route,
|
||||||
|
.unroute = _unroute,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user