Migrated migrate_job_t to INIT/METHOD macros

This commit is contained in:
Andreas Steffen
2011-02-10 08:06:06 +01:00
parent 43c4a21bd9
commit 8125dcca59
+18 -19
View File
@@ -57,10 +57,8 @@ struct private_migrate_job_t {
host_t *remote; host_t *remote;
}; };
/** METHOD(job_t, destroy, void,
* Implementation of job_t.destroy. private_migrate_job_t *this)
*/
static void destroy(private_migrate_job_t *this)
{ {
DESTROY_IF(this->src_ts); DESTROY_IF(this->src_ts);
DESTROY_IF(this->dst_ts); DESTROY_IF(this->dst_ts);
@@ -69,10 +67,8 @@ static void destroy(private_migrate_job_t *this)
free(this); free(this);
} }
/** METHOD(job_t, execute, void,
* Implementation of job_t.execute. private_migrate_job_t *this)
*/
static void execute(private_migrate_job_t *this)
{ {
ike_sa_t *ike_sa = NULL; ike_sa_t *ike_sa = NULL;
@@ -133,18 +129,21 @@ migrate_job_t *migrate_job_create(u_int32_t reqid,
policy_dir_t dir, policy_dir_t dir,
host_t *local, host_t *remote) host_t *local, host_t *remote)
{ {
private_migrate_job_t *this = malloc_thing(private_migrate_job_t); private_migrate_job_t *this;
/* interface functions */ INIT(this,
this->public.job_interface.execute = (void (*) (job_t *)) execute; .public = {
this->public.job_interface.destroy = (void (*)(job_t*)) destroy; .job_interface = {
.execute = _execute,
/* private variables */ .destroy = _destroy,
this->reqid = reqid; },
this->src_ts = (dir == POLICY_OUT) ? src_ts : dst_ts; },
this->dst_ts = (dir == POLICY_OUT) ? dst_ts : src_ts; .reqid = reqid,
this->local = local; .src_ts = (dir == POLICY_OUT) ? src_ts : dst_ts,
this->remote = remote; .dst_ts = (dir == POLICY_OUT) ? dst_ts : src_ts,
.local = local,
.remote = remote,
);
return &this->public; return &this->public;
} }