diff options
author | Yves-Alexis Perez <corsac@corsac.net> | 2012-06-28 21:16:07 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@corsac.net> | 2012-06-28 21:16:07 +0200 |
commit | b34738ed08c2227300d554b139e2495ca5da97d6 (patch) | |
tree | 62f33b52820f2e49f0e53c0f8c636312037c8054 /src/libcharon/processing/jobs/initiate_mediation_job.c | |
parent | 0a9d51a49042a68daa15b0c74a2b7f152f52606b (diff) | |
download | vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.tar.gz vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.zip |
Imported Upstream version 4.6.4
Diffstat (limited to 'src/libcharon/processing/jobs/initiate_mediation_job.c')
-rw-r--r-- | src/libcharon/processing/jobs/initiate_mediation_job.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/src/libcharon/processing/jobs/initiate_mediation_job.c b/src/libcharon/processing/jobs/initiate_mediation_job.c index ffe8755e2..e52f3c6df 100644 --- a/src/libcharon/processing/jobs/initiate_mediation_job.c +++ b/src/libcharon/processing/jobs/initiate_mediation_job.c @@ -41,10 +41,8 @@ struct private_initiate_mediation_job_t { ike_sa_id_t *mediation_sa_id; }; -/** - * Implements job_t.destroy. - */ -static void destroy(private_initiate_mediation_job_t *this) +METHOD(job_t, destroy, void, + private_initiate_mediation_job_t *this) { DESTROY_IF(this->mediation_sa_id); DESTROY_IF(this->mediated_sa_id); @@ -66,10 +64,8 @@ static bool initiate_callback(private_initiate_mediation_job_t *this, return TRUE; } -/** - * Implementation of job_t.execute. - */ -static void initiate(private_initiate_mediation_job_t *this) +METHOD(job_t, initiate, void, + private_initiate_mediation_job_t *this) { ike_sa_t *mediated_sa, *mediation_sa; peer_cfg_t *mediated_cfg, *mediation_cfg; @@ -126,7 +122,7 @@ static void initiate(private_initiate_mediation_job_t *this) mediation_cfg->get_ref(mediation_cfg); if (charon->controller->initiate(charon->controller, mediation_cfg, - NULL, (controller_cb_t)initiate_callback, this) != SUCCESS) + NULL, (controller_cb_t)initiate_callback, this, 0) != SUCCESS) { mediation_cfg->destroy(mediation_cfg); mediated_cfg->destroy(mediated_cfg); @@ -172,10 +168,8 @@ static void initiate(private_initiate_mediation_job_t *this) destroy(this); } -/** - * Implementation of job_t.execute. - */ -static void reinitiate(private_initiate_mediation_job_t *this) +METHOD(job_t, reinitiate, void, + private_initiate_mediation_job_t *this) { ike_sa_t *mediated_sa, *mediation_sa; peer_cfg_t *mediated_cfg; @@ -223,20 +217,26 @@ static void reinitiate(private_initiate_mediation_job_t *this) destroy(this); } +METHOD(job_t, get_priority, job_priority_t, + private_initiate_mediation_job_t *this) +{ + return JOB_PRIO_MEDIUM; +} + /** * Creates an empty job */ static private_initiate_mediation_job_t *initiate_mediation_job_create_empty() { - private_initiate_mediation_job_t *this = malloc_thing(private_initiate_mediation_job_t); - - /* interface functions */ - this->public.job_interface.destroy = (void (*) (job_t *)) destroy; - - /* private variables */ - this->mediation_sa_id = NULL; - this->mediated_sa_id = NULL; - + private_initiate_mediation_job_t *this; + INIT(this, + .public = { + .job_interface = { + .get_priority = _get_priority, + .destroy = _destroy, + }, + }, + ); return this; } @@ -247,8 +247,7 @@ initiate_mediation_job_t *initiate_mediation_job_create(ike_sa_id_t *ike_sa_id) { private_initiate_mediation_job_t *this = initiate_mediation_job_create_empty(); - this->public.job_interface.execute = (void (*) (job_t *)) initiate; - + this->public.job_interface.execute = _initiate; this->mediated_sa_id = ike_sa_id->clone(ike_sa_id); return &this->public; @@ -262,8 +261,7 @@ initiate_mediation_job_t *reinitiate_mediation_job_create(ike_sa_id_t *mediation { private_initiate_mediation_job_t *this = initiate_mediation_job_create_empty(); - this->public.job_interface.execute = (void (*) (job_t *)) reinitiate; - + this->public.job_interface.execute = _reinitiate; this->mediation_sa_id = mediation_sa_id->clone(mediation_sa_id); this->mediated_sa_id = mediated_sa_id->clone(mediated_sa_id); |