summaryrefslogtreecommitdiff
path: root/src/libcharon/processing/jobs/migrate_job.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/processing/jobs/migrate_job.c')
-rw-r--r--src/libcharon/processing/jobs/migrate_job.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/libcharon/processing/jobs/migrate_job.c b/src/libcharon/processing/jobs/migrate_job.c
index 05f47340c..5e7c7ae88 100644
--- a/src/libcharon/processing/jobs/migrate_job.c
+++ b/src/libcharon/processing/jobs/migrate_job.c
@@ -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);
-
- /* 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;
+ private_migrate_job_t *this;
+
+ 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;
}