Migrated child_rekey to INIT/METHOD macros
This commit is contained in:
@@ -128,10 +128,8 @@ static void find_child(private_child_rekey_t *this, message_t *message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(task_t, build_i, status_t,
|
||||||
* Implementation of task_t.build for initiator
|
private_child_rekey_t *this, message_t *message)
|
||||||
*/
|
|
||||||
static status_t build_i(private_child_rekey_t *this, message_t *message)
|
|
||||||
{
|
{
|
||||||
notify_payload_t *notify;
|
notify_payload_t *notify;
|
||||||
u_int32_t reqid;
|
u_int32_t reqid;
|
||||||
@@ -175,10 +173,8 @@ static status_t build_i(private_child_rekey_t *this, message_t *message)
|
|||||||
return NEED_MORE;
|
return NEED_MORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(task_t, process_r, status_t,
|
||||||
* Implementation of task_t.process for initiator
|
private_child_rekey_t *this, message_t *message)
|
||||||
*/
|
|
||||||
static status_t process_r(private_child_rekey_t *this, message_t *message)
|
|
||||||
{
|
{
|
||||||
/* let the CHILD_CREATE task process the message */
|
/* let the CHILD_CREATE task process the message */
|
||||||
this->child_create->task.process(&this->child_create->task, message);
|
this->child_create->task.process(&this->child_create->task, message);
|
||||||
@@ -188,10 +184,8 @@ static status_t process_r(private_child_rekey_t *this, message_t *message)
|
|||||||
return NEED_MORE;
|
return NEED_MORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(task_t, build_r, status_t,
|
||||||
* Implementation of task_t.build for responder
|
private_child_rekey_t *this, message_t *message)
|
||||||
*/
|
|
||||||
static status_t build_r(private_child_rekey_t *this, message_t *message)
|
|
||||||
{
|
{
|
||||||
u_int32_t reqid;
|
u_int32_t reqid;
|
||||||
|
|
||||||
@@ -287,10 +281,8 @@ static child_sa_t *handle_collision(private_child_rekey_t *this)
|
|||||||
return to_delete;
|
return to_delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(task_t, process_i, status_t,
|
||||||
* Implementation of task_t.process for initiator
|
private_child_rekey_t *this, message_t *message)
|
||||||
*/
|
|
||||||
static status_t process_i(private_child_rekey_t *this, message_t *message)
|
|
||||||
{
|
{
|
||||||
protocol_id_t protocol;
|
protocol_id_t protocol;
|
||||||
u_int32_t spi;
|
u_int32_t spi;
|
||||||
@@ -367,18 +359,14 @@ static status_t process_i(private_child_rekey_t *this, message_t *message)
|
|||||||
return NEED_MORE;
|
return NEED_MORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(task_t, get_type, task_type_t,
|
||||||
* Implementation of task_t.get_type
|
private_child_rekey_t *this)
|
||||||
*/
|
|
||||||
static task_type_t get_type(private_child_rekey_t *this)
|
|
||||||
{
|
{
|
||||||
return CHILD_REKEY;
|
return CHILD_REKEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(child_rekey_t, collide, void,
|
||||||
* Implementation of child_rekey_t.collide
|
private_child_rekey_t *this, task_t *other)
|
||||||
*/
|
|
||||||
static void collide(private_child_rekey_t *this, task_t *other)
|
|
||||||
{
|
{
|
||||||
/* the task manager only detects exchange collision, but not if
|
/* the task manager only detects exchange collision, but not if
|
||||||
* the collision is for the same child. we check it here. */
|
* the collision is for the same child. we check it here. */
|
||||||
@@ -421,10 +409,8 @@ static void collide(private_child_rekey_t *this, task_t *other)
|
|||||||
this->collision = other;
|
this->collision = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(task_t, migrate, void,
|
||||||
* Implementation of task_t.migrate
|
private_child_rekey_t *this, ike_sa_t *ike_sa)
|
||||||
*/
|
|
||||||
static void migrate(private_child_rekey_t *this, ike_sa_t *ike_sa)
|
|
||||||
{
|
{
|
||||||
if (this->child_create)
|
if (this->child_create)
|
||||||
{
|
{
|
||||||
@@ -440,10 +426,8 @@ static void migrate(private_child_rekey_t *this, ike_sa_t *ike_sa)
|
|||||||
this->collision = NULL;
|
this->collision = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(task_t, destroy, void,
|
||||||
* Implementation of task_t.destroy
|
private_child_rekey_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_child_rekey_t *this)
|
|
||||||
{
|
{
|
||||||
if (this->child_create)
|
if (this->child_create)
|
||||||
{
|
{
|
||||||
@@ -463,34 +447,36 @@ static void destroy(private_child_rekey_t *this)
|
|||||||
child_rekey_t *child_rekey_create(ike_sa_t *ike_sa, protocol_id_t protocol,
|
child_rekey_t *child_rekey_create(ike_sa_t *ike_sa, protocol_id_t protocol,
|
||||||
u_int32_t spi)
|
u_int32_t spi)
|
||||||
{
|
{
|
||||||
private_child_rekey_t *this = malloc_thing(private_child_rekey_t);
|
private_child_rekey_t *this;
|
||||||
|
|
||||||
this->public.collide = (void (*)(child_rekey_t*,task_t*))collide;
|
INIT(this,
|
||||||
this->public.task.get_type = (task_type_t(*)(task_t*))get_type;
|
.public = {
|
||||||
this->public.task.migrate = (void(*)(task_t*,ike_sa_t*))migrate;
|
.task = {
|
||||||
this->public.task.destroy = (void(*)(task_t*))destroy;
|
.get_type = _get_type,
|
||||||
|
.migrate = _migrate,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
.collide = _collide,
|
||||||
|
},
|
||||||
|
.ike_sa = ike_sa,
|
||||||
|
.protocol = protocol,
|
||||||
|
.spi = spi,
|
||||||
|
);
|
||||||
|
|
||||||
if (protocol != PROTO_NONE)
|
if (protocol != PROTO_NONE)
|
||||||
{
|
{
|
||||||
this->public.task.build = (status_t(*)(task_t*,message_t*))build_i;
|
this->public.task.build = _build_i;
|
||||||
this->public.task.process = (status_t(*)(task_t*,message_t*))process_i;
|
this->public.task.process = _process_i;
|
||||||
this->initiator = TRUE;
|
this->initiator = TRUE;
|
||||||
this->child_create = NULL;
|
this->child_create = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->public.task.build = (status_t(*)(task_t*,message_t*))build_r;
|
this->public.task.build = _build_r;
|
||||||
this->public.task.process = (status_t(*)(task_t*,message_t*))process_r;
|
this->public.task.process = _process_r;
|
||||||
this->initiator = FALSE;
|
this->initiator = FALSE;
|
||||||
this->child_create = child_create_create(ike_sa, NULL, TRUE, NULL, NULL);
|
this->child_create = child_create_create(ike_sa, NULL, TRUE, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ike_sa = ike_sa;
|
|
||||||
this->child_sa = NULL;
|
|
||||||
this->protocol = protocol;
|
|
||||||
this->spi = spi;
|
|
||||||
this->collision = NULL;
|
|
||||||
this->child_delete = NULL;
|
|
||||||
this->other_child_destroyed = FALSE;
|
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user