diff options
| author | René Mayrhofer <rene@mayrhofer.eu.org> | 2011-03-05 09:29:19 +0100 |
|---|---|---|
| committer | René Mayrhofer <rene@mayrhofer.eu.org> | 2011-03-05 09:29:19 +0100 |
| commit | 365e71f706b40c32173fa06c6feaac48c1527520 (patch) | |
| tree | 54fa72a914d18c9430eaa54f3de4a2d4419198af /src/libcharon/processing | |
| parent | 5d7669b7b3563c50b3c86903e0a49373d597b8a0 (diff) | |
| parent | 568905f488e63e28778f87ac0e38d845f45bae79 (diff) | |
| download | vyos-strongswan-365e71f706b40c32173fa06c6feaac48c1527520.tar.gz vyos-strongswan-365e71f706b40c32173fa06c6feaac48c1527520.zip | |
Fixed merge, don't know why this didn't happen automatically - maybe a leftover from the svn->git conversion
Diffstat (limited to 'src/libcharon/processing')
| -rw-r--r-- | src/libcharon/processing/jobs/acquire_job.c | 26 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/delete_child_sa_job.c | 26 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/delete_ike_sa_job.c | 25 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/migrate_job.c | 28 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/process_message_job.c | 24 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/rekey_child_sa_job.c | 26 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/rekey_ike_sa_job.c | 25 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/retransmit_job.c | 25 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/roam_job.c | 24 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/send_dpd_job.c | 24 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/send_keepalive_job.c | 24 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/start_action_job.c | 101 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/start_action_job.h | 49 | ||||
| -rw-r--r-- | src/libcharon/processing/jobs/update_sa_job.c | 29 |
14 files changed, 456 insertions, 0 deletions
diff --git a/src/libcharon/processing/jobs/acquire_job.c b/src/libcharon/processing/jobs/acquire_job.c index 45ace9312..7a38d2553 100644 --- a/src/libcharon/processing/jobs/acquire_job.c +++ b/src/libcharon/processing/jobs/acquire_job.c @@ -45,20 +45,30 @@ struct private_acquire_job_t { traffic_selector_t *dst_ts; }; +<<<<<<< HEAD /** * Implementation of job_t.destroy. */ static void destroy(private_acquire_job_t *this) +======= +METHOD(job_t, destroy, void, + private_acquire_job_t *this) +>>>>>>> upstream/4.5.1 { DESTROY_IF(this->src_ts); DESTROY_IF(this->dst_ts); free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_acquire_job_t *this) +======= +METHOD(job_t, execute, void, + private_acquire_job_t *this) +>>>>>>> upstream/4.5.1 { charon->traps->acquire(charon->traps, this->reqid, this->src_ts, this->dst_ts); @@ -72,6 +82,7 @@ acquire_job_t *acquire_job_create(u_int32_t reqid, traffic_selector_t *src_ts, traffic_selector_t *dst_ts) { +<<<<<<< HEAD private_acquire_job_t *this = malloc_thing(private_acquire_job_t); this->public.job_interface.execute = (void (*) (job_t *)) execute; @@ -80,6 +91,21 @@ acquire_job_t *acquire_job_create(u_int32_t reqid, this->reqid = reqid; this->src_ts = src_ts; this->dst_ts = dst_ts; +======= + private_acquire_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .reqid = reqid, + .src_ts = src_ts, + .dst_ts = dst_ts, + ); +>>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/processing/jobs/delete_child_sa_job.c b/src/libcharon/processing/jobs/delete_child_sa_job.c index ca55721f2..12b4dc1e2 100644 --- a/src/libcharon/processing/jobs/delete_child_sa_job.c +++ b/src/libcharon/processing/jobs/delete_child_sa_job.c @@ -46,18 +46,28 @@ struct private_delete_child_sa_job_t { u_int32_t spi; }; +<<<<<<< HEAD /** * Implementation of job_t.destroy. */ static void destroy(private_delete_child_sa_job_t *this) +======= +METHOD(job_t, destroy, void, + private_delete_child_sa_job_t *this) +>>>>>>> upstream/4.5.1 { free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_delete_child_sa_job_t *this) +======= +METHOD(job_t, execute, void, + private_delete_child_sa_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; @@ -84,6 +94,7 @@ delete_child_sa_job_t *delete_child_sa_job_create(u_int32_t reqid, protocol_id_t protocol, u_int32_t spi) { +<<<<<<< HEAD private_delete_child_sa_job_t *this = malloc_thing(private_delete_child_sa_job_t); /* interface functions */ @@ -94,6 +105,21 @@ delete_child_sa_job_t *delete_child_sa_job_create(u_int32_t reqid, this->reqid = reqid; this->protocol = protocol; this->spi = spi; +======= + private_delete_child_sa_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .reqid = reqid, + .protocol = protocol, + .spi = spi, + ); +>>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/processing/jobs/delete_ike_sa_job.c b/src/libcharon/processing/jobs/delete_ike_sa_job.c index dffd08ba3..2297f3fba 100644 --- a/src/libcharon/processing/jobs/delete_ike_sa_job.c +++ b/src/libcharon/processing/jobs/delete_ike_sa_job.c @@ -41,19 +41,29 @@ struct private_delete_ike_sa_job_t { }; +<<<<<<< HEAD /** * Implements job_t.destroy. */ static void destroy(private_delete_ike_sa_job_t *this) +======= +METHOD(job_t, destroy, void, + private_delete_ike_sa_job_t *this) +>>>>>>> upstream/4.5.1 { this->ike_sa_id->destroy(this->ike_sa_id); free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_delete_ike_sa_job_t *this) +======= +METHOD(job_t, execute, void, + private_delete_ike_sa_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; @@ -102,6 +112,7 @@ static void execute(private_delete_ike_sa_job_t *this) delete_ike_sa_job_t *delete_ike_sa_job_create(ike_sa_id_t *ike_sa_id, bool delete_if_established) { +<<<<<<< HEAD private_delete_ike_sa_job_t *this = malloc_thing(private_delete_ike_sa_job_t); /* interface functions */ @@ -111,6 +122,20 @@ delete_ike_sa_job_t *delete_ike_sa_job_create(ike_sa_id_t *ike_sa_id, /* private variables */ this->ike_sa_id = ike_sa_id->clone(ike_sa_id); this->delete_if_established = delete_if_established; +======= + private_delete_ike_sa_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .ike_sa_id = ike_sa_id->clone(ike_sa_id), + .delete_if_established = delete_if_established, + ); +>>>>>>> upstream/4.5.1 return &(this->public); } diff --git a/src/libcharon/processing/jobs/migrate_job.c b/src/libcharon/processing/jobs/migrate_job.c index 05f47340c..7ddd0a82b 100644 --- a/src/libcharon/processing/jobs/migrate_job.c +++ b/src/libcharon/processing/jobs/migrate_job.c @@ -57,10 +57,15 @@ struct private_migrate_job_t { host_t *remote; }; +<<<<<<< HEAD /** * Implementation of job_t.destroy. */ static void destroy(private_migrate_job_t *this) +======= +METHOD(job_t, destroy, void, + private_migrate_job_t *this) +>>>>>>> upstream/4.5.1 { DESTROY_IF(this->src_ts); DESTROY_IF(this->dst_ts); @@ -69,10 +74,15 @@ static void destroy(private_migrate_job_t *this) free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_migrate_job_t *this) +======= +METHOD(job_t, execute, void, + private_migrate_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa = NULL; @@ -133,6 +143,7 @@ migrate_job_t *migrate_job_create(u_int32_t reqid, policy_dir_t dir, host_t *local, host_t *remote) { +<<<<<<< HEAD private_migrate_job_t *this = malloc_thing(private_migrate_job_t); /* interface functions */ @@ -145,6 +156,23 @@ migrate_job_t *migrate_job_create(u_int32_t reqid, 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, + ); +>>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/processing/jobs/process_message_job.c b/src/libcharon/processing/jobs/process_message_job.c index a47d48e38..733775cfa 100644 --- a/src/libcharon/processing/jobs/process_message_job.c +++ b/src/libcharon/processing/jobs/process_message_job.c @@ -35,19 +35,29 @@ struct private_process_message_job_t { message_t *message; }; +<<<<<<< HEAD /** * Implements job_t.destroy. */ static void destroy(private_process_message_job_t *this) +======= +METHOD(job_t, destroy, void, + private_process_message_job_t *this) +>>>>>>> upstream/4.5.1 { this->message->destroy(this->message); free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_process_message_job_t *this) +======= +METHOD(job_t, execute, void, + private_process_message_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; @@ -93,6 +103,7 @@ static void execute(private_process_message_job_t *this) */ process_message_job_t *process_message_job_create(message_t *message) { +<<<<<<< HEAD private_process_message_job_t *this = malloc_thing(private_process_message_job_t); /* interface functions */ @@ -101,6 +112,19 @@ process_message_job_t *process_message_job_create(message_t *message) /* private variables */ this->message = message; +======= + private_process_message_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .message = message, + ); +>>>>>>> upstream/4.5.1 return &(this->public); } diff --git a/src/libcharon/processing/jobs/rekey_child_sa_job.c b/src/libcharon/processing/jobs/rekey_child_sa_job.c index b797d181e..5e147fda6 100644 --- a/src/libcharon/processing/jobs/rekey_child_sa_job.c +++ b/src/libcharon/processing/jobs/rekey_child_sa_job.c @@ -45,18 +45,28 @@ struct private_rekey_child_sa_job_t { u_int32_t spi; }; +<<<<<<< HEAD /** * Implementation of job_t.destroy. */ static void destroy(private_rekey_child_sa_job_t *this) +======= +METHOD(job_t, destroy, void, + private_rekey_child_sa_job_t *this) +>>>>>>> upstream/4.5.1 { free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_rekey_child_sa_job_t *this) +======= +METHOD(job_t, execute, void, + private_rekey_child_sa_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; @@ -82,6 +92,7 @@ rekey_child_sa_job_t *rekey_child_sa_job_create(u_int32_t reqid, protocol_id_t protocol, u_int32_t spi) { +<<<<<<< HEAD private_rekey_child_sa_job_t *this = malloc_thing(private_rekey_child_sa_job_t); /* interface functions */ @@ -92,6 +103,21 @@ rekey_child_sa_job_t *rekey_child_sa_job_create(u_int32_t reqid, this->reqid = reqid; this->protocol = protocol; this->spi = spi; +======= + private_rekey_child_sa_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .reqid = reqid, + .protocol = protocol, + .spi = spi, + ); +>>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/processing/jobs/rekey_ike_sa_job.c b/src/libcharon/processing/jobs/rekey_ike_sa_job.c index 5ec0b1b88..5f43b2cd5 100644 --- a/src/libcharon/processing/jobs/rekey_ike_sa_job.c +++ b/src/libcharon/processing/jobs/rekey_ike_sa_job.c @@ -39,19 +39,29 @@ struct private_rekey_ike_sa_job_t { bool reauth; }; +<<<<<<< HEAD /** * Implementation of job_t.destroy. */ static void destroy(private_rekey_ike_sa_job_t *this) +======= +METHOD(job_t, destroy, void, + private_rekey_ike_sa_job_t *this) +>>>>>>> upstream/4.5.1 { this->ike_sa_id->destroy(this->ike_sa_id); free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_rekey_ike_sa_job_t *this) +======= +METHOD(job_t, execute, void, + private_rekey_ike_sa_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; status_t status = SUCCESS; @@ -90,6 +100,7 @@ static void execute(private_rekey_ike_sa_job_t *this) */ rekey_ike_sa_job_t *rekey_ike_sa_job_create(ike_sa_id_t *ike_sa_id, bool reauth) { +<<<<<<< HEAD private_rekey_ike_sa_job_t *this = malloc_thing(private_rekey_ike_sa_job_t); /* interface functions */ @@ -99,6 +110,20 @@ rekey_ike_sa_job_t *rekey_ike_sa_job_create(ike_sa_id_t *ike_sa_id, bool reauth) /* private variables */ this->ike_sa_id = ike_sa_id->clone(ike_sa_id); this->reauth = reauth; +======= + private_rekey_ike_sa_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .ike_sa_id = ike_sa_id->clone(ike_sa_id), + .reauth = reauth, + ); +>>>>>>> upstream/4.5.1 return &(this->public); } diff --git a/src/libcharon/processing/jobs/retransmit_job.c b/src/libcharon/processing/jobs/retransmit_job.c index fc787f208..0b73f1485 100644 --- a/src/libcharon/processing/jobs/retransmit_job.c +++ b/src/libcharon/processing/jobs/retransmit_job.c @@ -40,19 +40,29 @@ struct private_retransmit_job_t { ike_sa_id_t *ike_sa_id; }; +<<<<<<< HEAD /** * Implements job_t.destroy. */ static void destroy(private_retransmit_job_t *this) +======= +METHOD(job_t, destroy, void, + private_retransmit_job_t *this) +>>>>>>> upstream/4.5.1 { this->ike_sa_id->destroy(this->ike_sa_id); free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_retransmit_job_t *this) +======= +METHOD(job_t, execute, void, + private_retransmit_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; @@ -79,6 +89,7 @@ static void execute(private_retransmit_job_t *this) */ retransmit_job_t *retransmit_job_create(u_int32_t message_id,ike_sa_id_t *ike_sa_id) { +<<<<<<< HEAD private_retransmit_job_t *this = malloc_thing(private_retransmit_job_t); /* interface functions */ @@ -88,6 +99,20 @@ retransmit_job_t *retransmit_job_create(u_int32_t message_id,ike_sa_id_t *ike_sa /* private variables */ this->message_id = message_id; this->ike_sa_id = ike_sa_id->clone(ike_sa_id); +======= + private_retransmit_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .message_id = message_id, + .ike_sa_id = ike_sa_id->clone(ike_sa_id), + ); +>>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/processing/jobs/roam_job.c b/src/libcharon/processing/jobs/roam_job.c index adc884a8a..bcc96686c 100644 --- a/src/libcharon/processing/jobs/roam_job.c +++ b/src/libcharon/processing/jobs/roam_job.c @@ -38,18 +38,28 @@ struct private_roam_job_t { bool address; }; +<<<<<<< HEAD /** * Implements job_t.destroy. */ static void destroy(private_roam_job_t *this) +======= +METHOD(job_t, destroy, void, + private_roam_job_t *this) +>>>>>>> upstream/4.5.1 { free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_roam_job_t *this) +======= +METHOD(job_t, execute, void, + private_roam_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; linked_list_t *list; @@ -94,12 +104,26 @@ static void execute(private_roam_job_t *this) */ roam_job_t *roam_job_create(bool address) { +<<<<<<< HEAD private_roam_job_t *this = malloc_thing(private_roam_job_t); this->public.job_interface.execute = (void (*) (job_t *)) execute; this->public.job_interface.destroy = (void (*) (job_t *)) destroy; this->address = address; +======= + private_roam_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .address = address, + ); +>>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/processing/jobs/send_dpd_job.c b/src/libcharon/processing/jobs/send_dpd_job.c index 1c2da52b8..0a0fd2144 100644 --- a/src/libcharon/processing/jobs/send_dpd_job.c +++ b/src/libcharon/processing/jobs/send_dpd_job.c @@ -38,19 +38,29 @@ struct private_send_dpd_job_t { ike_sa_id_t *ike_sa_id; }; +<<<<<<< HEAD /** * Implements job_t.destroy. */ static void destroy(private_send_dpd_job_t *this) +======= +METHOD(job_t, destroy, void, + private_send_dpd_job_t *this) +>>>>>>> upstream/4.5.1 { this->ike_sa_id->destroy(this->ike_sa_id); free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_send_dpd_job_t *this) +======= +METHOD(job_t, execute, void, + private_send_dpd_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; @@ -75,6 +85,7 @@ static void execute(private_send_dpd_job_t *this) */ send_dpd_job_t *send_dpd_job_create(ike_sa_id_t *ike_sa_id) { +<<<<<<< HEAD private_send_dpd_job_t *this = malloc_thing(private_send_dpd_job_t); /* interface functions */ @@ -83,6 +94,19 @@ send_dpd_job_t *send_dpd_job_create(ike_sa_id_t *ike_sa_id) /* private variables */ this->ike_sa_id = ike_sa_id->clone(ike_sa_id); +======= + private_send_dpd_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .ike_sa_id = ike_sa_id->clone(ike_sa_id), + ); +>>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/processing/jobs/send_keepalive_job.c b/src/libcharon/processing/jobs/send_keepalive_job.c index 3d02cea2e..21b78919f 100644 --- a/src/libcharon/processing/jobs/send_keepalive_job.c +++ b/src/libcharon/processing/jobs/send_keepalive_job.c @@ -38,19 +38,29 @@ struct private_send_keepalive_job_t { ike_sa_id_t *ike_sa_id; }; +<<<<<<< HEAD /** * Implements job_t.destroy. */ static void destroy(private_send_keepalive_job_t *this) +======= +METHOD(job_t, destroy, void, + private_send_keepalive_job_t *this) +>>>>>>> upstream/4.5.1 { this->ike_sa_id->destroy(this->ike_sa_id); free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_send_keepalive_job_t *this) +======= +METHOD(job_t, execute, void, + private_send_keepalive_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; @@ -69,6 +79,7 @@ static void execute(private_send_keepalive_job_t *this) */ send_keepalive_job_t *send_keepalive_job_create(ike_sa_id_t *ike_sa_id) { +<<<<<<< HEAD private_send_keepalive_job_t *this = malloc_thing(private_send_keepalive_job_t); /* interface functions */ @@ -77,6 +88,19 @@ send_keepalive_job_t *send_keepalive_job_create(ike_sa_id_t *ike_sa_id) /* private variables */ this->ike_sa_id = ike_sa_id->clone(ike_sa_id); +======= + private_send_keepalive_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .ike_sa_id = ike_sa_id->clone(ike_sa_id), + ); +>>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/processing/jobs/start_action_job.c b/src/libcharon/processing/jobs/start_action_job.c new file mode 100644 index 000000000..5dda18be2 --- /dev/null +++ b/src/libcharon/processing/jobs/start_action_job.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2011 Andreas Steffen + * HSR Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "start_action_job.h" + +#include <daemon.h> + + +typedef struct private_start_action_job_t private_start_action_job_t; + +/** + * Private data of an start_action_job_t object. + */ +struct private_start_action_job_t { + /** + * Public start_action_job_t interface. + */ + start_action_job_t public; +}; + +METHOD(job_t, destroy, void, + private_start_action_job_t *this) +{ + free(this); +} + +METHOD(job_t, execute, void, + private_start_action_job_t *this) +{ + enumerator_t *enumerator, *children; + peer_cfg_t *peer_cfg; + child_cfg_t *child_cfg; + char *name; + + enumerator = charon->backends->create_peer_cfg_enumerator(charon->backends, + NULL, NULL, NULL, NULL); + while (enumerator->enumerate(enumerator, &peer_cfg)) + { + if (peer_cfg->get_ike_version(peer_cfg) != 2) + { + continue; + } + + children = peer_cfg->create_child_cfg_enumerator(peer_cfg); + while (children->enumerate(children, &child_cfg)) + { + name = child_cfg->get_name(child_cfg); + + switch (child_cfg->get_start_action(child_cfg)) + { + case ACTION_RESTART: + DBG1(DBG_JOB, "start action: initiate '%s'", name); + charon->controller->initiate(charon->controller, + peer_cfg->get_ref(peer_cfg), + child_cfg->get_ref(child_cfg), + NULL, NULL); + break; + case ACTION_ROUTE: + DBG1(DBG_JOB, "start action: route '%s'", name); + charon->traps->install(charon->traps, peer_cfg, child_cfg); + break; + case ACTION_NONE: + break; + } + } + children->destroy(children); + } + enumerator->destroy(enumerator); + destroy(this); +} + +/* + * Described in header + */ +start_action_job_t *start_action_job_create(void) +{ + private_start_action_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + ) + return &this->public; +} + diff --git a/src/libcharon/processing/jobs/start_action_job.h b/src/libcharon/processing/jobs/start_action_job.h new file mode 100644 index 000000000..ffc167c05 --- /dev/null +++ b/src/libcharon/processing/jobs/start_action_job.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011 Andreas Steffen + * HSR Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +/** + * @defgroup start_action_job start_action_job + * @{ @ingroup cjobs + */ + +#ifndef START_ACTION_JOB_H_ +#define START_ACTION_JOB_H_ + +typedef struct start_action_job_t start_action_job_t; + +#include <library.h> +#include <processing/jobs/job.h> + +/** + * Class representing a start_action Job. + * + * This job handles all child configurations stored in an [SQL database] + * backend according to their start_action field (start, route, none). + */ +struct start_action_job_t { + /** + * The job_t interface. + */ + job_t job_interface; +}; + +/** + * Creates a job of type start_action. + * + * @return start_action_job_t object + */ +start_action_job_t *start_action_job_create(void); + +#endif /** START_ACTION_JOB_H_ @}*/ diff --git a/src/libcharon/processing/jobs/update_sa_job.c b/src/libcharon/processing/jobs/update_sa_job.c index 17dce2548..eeaf9f1c4 100644 --- a/src/libcharon/processing/jobs/update_sa_job.c +++ b/src/libcharon/processing/jobs/update_sa_job.c @@ -43,19 +43,29 @@ struct private_update_sa_job_t { host_t *new; }; +<<<<<<< HEAD /** * Implements job_t.destroy. */ static void destroy(private_update_sa_job_t *this) +======= +METHOD(job_t, destroy, void, + private_update_sa_job_t *this) +>>>>>>> upstream/4.5.1 { this->new->destroy(this->new); free(this); } +<<<<<<< HEAD /** * Implementation of job_t.execute. */ static void execute(private_update_sa_job_t *this) +======= +METHOD(job_t, execute, void, + private_update_sa_job_t *this) +>>>>>>> upstream/4.5.1 { ike_sa_t *ike_sa; @@ -71,7 +81,11 @@ static void execute(private_update_sa_job_t *this) if (ike_sa->has_condition(ike_sa, COND_NAT_THERE) && !ike_sa->has_condition(ike_sa, COND_NAT_HERE)) { +<<<<<<< HEAD ike_sa->update_hosts(ike_sa, NULL, this->new); +======= + ike_sa->update_hosts(ike_sa, NULL, this->new, FALSE); +>>>>>>> upstream/4.5.1 } charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa); } @@ -83,6 +97,7 @@ static void execute(private_update_sa_job_t *this) */ update_sa_job_t *update_sa_job_create(u_int32_t reqid, host_t *new) { +<<<<<<< HEAD private_update_sa_job_t *this = malloc_thing(private_update_sa_job_t); this->public.job_interface.execute = (void (*) (job_t *)) execute; @@ -90,6 +105,20 @@ update_sa_job_t *update_sa_job_create(u_int32_t reqid, host_t *new) this->reqid = reqid; this->new = new; +======= + private_update_sa_job_t *this; + + INIT(this, + .public = { + .job_interface = { + .execute = _execute, + .destroy = _destroy, + }, + }, + .reqid = reqid, + .new = new, + ); +>>>>>>> upstream/4.5.1 return &this->public; } |
