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;
};
/**
* Implementation of job_t.destroy.
*/
static void destroy(private_migrate_job_t *this)
METHOD(job_t, destroy, void,
private_migrate_job_t *this)
{
DESTROY_IF(this->src_ts);
DESTROY_IF(this->dst_ts);
@@ -69,10 +67,8 @@ static void destroy(private_migrate_job_t *this)
free(this);
}
/**
* Implementation of job_t.execute.
*/
static void execute(private_migrate_job_t *this)
METHOD(job_t, execute, void,
private_migrate_job_t *this)
{
ike_sa_t *ike_sa = NULL;
@@ -133,18 +129,21 @@ migrate_job_t *migrate_job_create(u_int32_t reqid,
policy_dir_t dir,
host_t *local, host_t *remote)
{
private_migrate_job_t *this = malloc_thing(private_migrate_job_t);
private_migrate_job_t *this;
/* interface functions */
this->public.job_interface.execute = (void (*) (job_t *)) execute;
this->public.job_interface.destroy = (void (*)(job_t*)) destroy;
/* private variables */
this->reqid = reqid;
this->src_ts = (dir == POLICY_OUT) ? src_ts : dst_ts;
this->dst_ts = (dir == POLICY_OUT) ? dst_ts : src_ts;
this->local = local;
this->remote = remote;
INIT(this,
.public = {
.job_interface = {
.execute = _execute,
.destroy = _destroy,
},
},
.reqid = reqid,
.src_ts = (dir == POLICY_OUT) ? src_ts : dst_ts,
.dst_ts = (dir == POLICY_OUT) ? dst_ts : src_ts,
.local = local,
.remote = remote,
);
return &this->public;
}