diff options
author | Tobias Brunner <tobias@strongswan.org> | 2011-11-17 16:54:25 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-03-20 17:30:43 +0100 |
commit | 273f2f80546a794141fd56b513c97985c629ab93 (patch) | |
tree | c412d993cdf2ce27b2a7977f6ebc0176b5821d64 /src | |
parent | 4b64a1a17d57586483a27d2ddcc4b3390f25ef94 (diff) | |
download | strongswan-273f2f80546a794141fd56b513c97985c629ab93.tar.bz2 strongswan-273f2f80546a794141fd56b513c97985c629ab93.tar.xz |
Added factory function to create task_manager_t implementations.
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/Makefile.am | 2 | ||||
-rw-r--r-- | src/libcharon/sa/ike_sa.c | 3 | ||||
-rw-r--r-- | src/libcharon/sa/task_manager.c | 33 |
3 files changed, 35 insertions, 3 deletions
diff --git a/src/libcharon/Makefile.am b/src/libcharon/Makefile.am index 5defff677..9b9bac085 100644 --- a/src/libcharon/Makefile.am +++ b/src/libcharon/Makefile.am @@ -67,7 +67,7 @@ sa/child_sa.c sa/child_sa.h \ sa/ike_sa.c sa/ike_sa.h \ sa/ike_sa_id.c sa/ike_sa_id.h \ sa/ike_sa_manager.c sa/ike_sa_manager.h \ -sa/task_manager.h sa/task_manager_v2.c sa/task_manager_v2.h \ +sa/task_manager.h sa/task_manager.c sa/task_manager_v2.c sa/task_manager_v2.h \ sa/task_manager_v1.c sa/task_manager_v1.h \ sa/keymat.h sa/keymat.c sa/keymat_v2.c sa/keymat_v2.h \ sa/keymat_v1.c sa/keymat_v1.h \ diff --git a/src/libcharon/sa/ike_sa.c b/src/libcharon/sa/ike_sa.c index e060c5a42..36ceea121 100644 --- a/src/libcharon/sa/ike_sa.c +++ b/src/libcharon/sa/ike_sa.c @@ -28,7 +28,6 @@ #include <daemon.h> #include <utils/linked_list.h> #include <utils/lexparser.h> -#include <sa/task_manager_v2.h> #include <sa/tasks/ike_init.h> #include <sa/tasks/ike_natd.h> #include <sa/tasks/ike_mobike.h> @@ -2225,7 +2224,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id, ike_version_t version) "charon.keep_alive", KEEPALIVE_INTERVAL), ); - this->task_manager = &(task_manager_v2_create(&this->public)->task_manager); + this->task_manager = task_manager_create(&this->public); this->my_host->set_port(this->my_host, IKEV2_UDP_PORT); return &this->public; diff --git a/src/libcharon/sa/task_manager.c b/src/libcharon/sa/task_manager.c new file mode 100644 index 000000000..eea2320e0 --- /dev/null +++ b/src/libcharon/sa/task_manager.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011 Tobias Brunner + * 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 "task_manager.h" +#include "task_manager_v1.h" +#include "task_manager_v2.h" + +/** + * See header + */ +task_manager_t *task_manager_create(ike_sa_t *ike_sa) +{ + switch (ike_sa->get_version(ike_sa)) + { + case IKEV1: + return &task_manager_v1_create(ike_sa)->task_manager; + case IKEV2: + return &task_manager_v2_create(ike_sa)->task_manager; + } + return NULL; +} |