From bcd887781ad725672b0f8af6efd8ddc5a0c42d4a Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Wed, 16 May 2007 08:49:10 +0000 Subject: [PATCH] removed route_job, handled all in interface_manager --- src/charon/Makefile.am | 1 - .../control/interfaces/stroke_interface.c | 1 - src/charon/processing/jobs/route_job.c | 133 ------------------ src/charon/processing/jobs/route_job.h | 59 -------- src/charon/sa/ike_sa.c | 1 - 5 files changed, 195 deletions(-) delete mode 100644 src/charon/processing/jobs/route_job.c delete mode 100644 src/charon/processing/jobs/route_job.h diff --git a/src/charon/Makefile.am b/src/charon/Makefile.am index 7615177e4..a64d9fa70 100644 --- a/src/charon/Makefile.am +++ b/src/charon/Makefile.am @@ -58,7 +58,6 @@ processing/jobs/process_message_job.c processing/jobs/process_message_job.h \ processing/jobs/rekey_child_sa_job.c processing/jobs/rekey_child_sa_job.h \ processing/jobs/rekey_ike_sa_job.c processing/jobs/rekey_ike_sa_job.h \ processing/jobs/retransmit_job.c processing/jobs/retransmit_job.h \ -processing/jobs/route_job.c processing/jobs/route_job.h \ processing/jobs/send_dpd_job.c processing/jobs/send_dpd_job.h \ processing/jobs/send_keepalive_job.c processing/jobs/send_keepalive_job.h \ processing/scheduler.c processing/scheduler.h \ diff --git a/src/charon/control/interfaces/stroke_interface.c b/src/charon/control/interfaces/stroke_interface.c index bbfc6506b..bbbed24a0 100755 --- a/src/charon/control/interfaces/stroke_interface.c +++ b/src/charon/control/interfaces/stroke_interface.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #define IKE_PORT 500 diff --git a/src/charon/processing/jobs/route_job.c b/src/charon/processing/jobs/route_job.c deleted file mode 100644 index 36afa5513..000000000 --- a/src/charon/processing/jobs/route_job.c +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @file route_job.c - * - * @brief Implementation of route_job_t. - * - */ - -/* - * Copyright (C) 2005-2007 Martin Willi - * 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 . - * - * 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 - -#include "route_job.h" - -#include - -typedef struct private_route_job_t private_route_job_t; - -/** - * Private data of an route_job_t Object - */ -struct private_route_job_t { - /** - * public route_job_t interface - */ - route_job_t public; - - /** - * peer config for route - */ - peer_cfg_t *peer_cfg; - - /** - * child config to route - */ - child_cfg_t *child_cfg; - - /** - * route or unroute? - */ - bool route; -}; - -/** - * Implements route_job_t.get_type. - */ -static job_type_t get_type(private_route_job_t *this) -{ - return ROUTE; -} - -/** - * Implementation of job_t.execute. - */ -static status_t execute(private_route_job_t *this) -{ - ike_sa_t *ike_sa; - ike_cfg_t *ike_cfg = this->peer_cfg->get_ike_cfg(this->peer_cfg); - - ike_sa = charon->ike_sa_manager->checkout_by_peer(charon->ike_sa_manager, - ike_cfg->get_my_host(ike_cfg), - ike_cfg->get_other_host(ike_cfg), - this->peer_cfg->get_my_id(this->peer_cfg), - this->peer_cfg->get_other_id(this->peer_cfg)); - - if (ike_sa->get_peer_cfg(ike_sa) == NULL) - { - ike_sa->set_peer_cfg(ike_sa, this->peer_cfg); - } - - if (this->route) - { - if (ike_sa->route(ike_sa, this->child_cfg) != SUCCESS) - { - DBG1(DBG_JOB, "routing failed"); - } - } - else - { - if (ike_sa->unroute(ike_sa, this->child_cfg) == DESTROY_ME) - { - DBG1(DBG_JOB, "removing IKE_SA, as last routed CHILD_SA unrouted"); - charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager, ike_sa); - return DESTROY_ME; - } - } - charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa); - return DESTROY_ME; -} - -/** - * Implements job_t.destroy. - */ -static void destroy(private_route_job_t *this) -{ - this->peer_cfg->destroy(this->peer_cfg); - this->child_cfg->destroy(this->child_cfg); - free(this); -} - -/* - * Described in header - */ -route_job_t *route_job_create(peer_cfg_t *peer_cfg, child_cfg_t *child_cfg, - bool route) -{ - private_route_job_t *this = malloc_thing(private_route_job_t); - - /* interface functions */ - this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type; - this->public.job_interface.execute = (status_t (*) (job_t *)) execute; - this->public.job_interface.destroy = (void (*) (job_t *)) destroy; - - /* private variables */ - this->peer_cfg = peer_cfg; - this->child_cfg = child_cfg; - this->route = route; - - return &this->public; -} diff --git a/src/charon/processing/jobs/route_job.h b/src/charon/processing/jobs/route_job.h deleted file mode 100644 index 840fcc92a..000000000 --- a/src/charon/processing/jobs/route_job.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file route_job.h - * - * @brief Interface of route_job_t. - */ - -/* - * Copyright (C) 2005-2007 Martin Willi - * 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 . - * - * 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. - */ - -#ifndef ROUTE_JOB_H_ -#define ROUTE_JOB_H_ - -typedef struct route_job_t route_job_t; - -#include -#include -#include - -/** - * @brief Class representing an ROUTE Job. - * - * @b Constructors: - * - route_job_create() - * - * @ingroup jobs - */ -struct route_job_t { - /** - * implements job_t interface - */ - job_t job_interface; -}; - -/** - * @brief Creates a job of type ROUTE. - * - * @param peer_cfg peer config to use for acquire - * @param child_cfg route to install - * @param route TRUE to route, FALSE to unroute - * @return route_job_t object - * - * @ingroup jobs - */ -route_job_t *route_job_create(peer_cfg_t *peer_cfg, child_cfg_t *child_cfg, - bool route); - -#endif /*ROUTE_JOB_H_*/ diff --git a/src/charon/sa/ike_sa.c b/src/charon/sa/ike_sa.c index d907f6366..7fd934d1e 100644 --- a/src/charon/sa/ike_sa.c +++ b/src/charon/sa/ike_sa.c @@ -62,7 +62,6 @@ #include #include #include -#include #ifndef RESOLV_CONF