diff options
Diffstat (limited to 'src/libcharon/processing/jobs/mediation_job.c')
-rw-r--r-- | src/libcharon/processing/jobs/mediation_job.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/src/libcharon/processing/jobs/mediation_job.c b/src/libcharon/processing/jobs/mediation_job.c index b5b8af3b3..6f02f2a0a 100644 --- a/src/libcharon/processing/jobs/mediation_job.c +++ b/src/libcharon/processing/jobs/mediation_job.c @@ -66,10 +66,8 @@ struct private_mediation_job_t { bool response; }; -/** - * Implements job_t.destroy. - */ -static void destroy(private_mediation_job_t *this) +METHOD(job_t, destroy, void, + private_mediation_job_t *this) { DESTROY_IF(this->target); DESTROY_IF(this->source); @@ -79,10 +77,8 @@ static void destroy(private_mediation_job_t *this) free(this); } -/** - * Implementation of job_t.execute. - */ -static void execute(private_mediation_job_t *this) +METHOD(job_t, execute, void, + private_mediation_job_t *this) { ike_sa_id_t *target_sa_id; @@ -137,26 +133,27 @@ static void execute(private_mediation_job_t *this) destroy(this); } +METHOD(job_t, get_priority, job_priority_t, + private_mediation_job_t *this) +{ + return JOB_PRIO_MEDIUM; +} + /** * Creates an empty mediation job */ static private_mediation_job_t *mediation_job_create_empty() { - private_mediation_job_t *this = malloc_thing(private_mediation_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->target = NULL; - this->source = NULL; - this->callback = FALSE; - this->connect_id = chunk_empty; - this->connect_key = chunk_empty; - this->endpoints = NULL; - this->response = FALSE; - + private_mediation_job_t *this; + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .get_priority = _get_priority, + .destroy = _destroy, + }, + }, + ); return this; } |