Use task manager as generic interface, renamed implementation to _v2.
This commit is contained in:
@@ -66,7 +66,7 @@ sa/child_sa.c sa/child_sa.h \
|
|||||||
sa/ike_sa.c sa/ike_sa.h \
|
sa/ike_sa.c sa/ike_sa.h \
|
||||||
sa/ike_sa_id.c sa/ike_sa_id.h \
|
sa/ike_sa_id.c sa/ike_sa_id.h \
|
||||||
sa/ike_sa_manager.c sa/ike_sa_manager.h \
|
sa/ike_sa_manager.c sa/ike_sa_manager.h \
|
||||||
sa/task_manager.c sa/task_manager.h \
|
sa/task_manager.h sa/task_manager_v2.c sa/task_manager_v2.h \
|
||||||
sa/keymat.c sa/keymat.h \
|
sa/keymat.c sa/keymat.h \
|
||||||
sa/shunt_manager.c sa/shunt_manager.h \
|
sa/shunt_manager.c sa/shunt_manager.h \
|
||||||
sa/trap_manager.c sa/trap_manager.h \
|
sa/trap_manager.c sa/trap_manager.h \
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <daemon.h>
|
#include <daemon.h>
|
||||||
#include <utils/linked_list.h>
|
#include <utils/linked_list.h>
|
||||||
#include <utils/lexparser.h>
|
#include <utils/lexparser.h>
|
||||||
#include <sa/task_manager.h>
|
#include <sa/task_manager_v2.h>
|
||||||
#include <sa/tasks/ike_init.h>
|
#include <sa/tasks/ike_init.h>
|
||||||
#include <sa/tasks/ike_natd.h>
|
#include <sa/tasks/ike_natd.h>
|
||||||
#include <sa/tasks/ike_mobike.h>
|
#include <sa/tasks/ike_mobike.h>
|
||||||
@@ -2209,7 +2209,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
|
|||||||
.keepalive_interval = lib->settings->get_time(lib->settings,
|
.keepalive_interval = lib->settings->get_time(lib->settings,
|
||||||
"charon.keep_alive", KEEPALIVE_INTERVAL),
|
"charon.keep_alive", KEEPALIVE_INTERVAL),
|
||||||
);
|
);
|
||||||
this->task_manager = task_manager_create(&this->public);
|
this->task_manager = &(task_manager_v2_create(&this->public)->task_manager);
|
||||||
this->my_host->set_port(this->my_host, IKEV2_UDP_PORT);
|
this->my_host->set_port(this->my_host, IKEV2_UDP_PORT);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
|
|||||||
@@ -194,11 +194,4 @@ struct task_manager_t {
|
|||||||
void (*destroy) (task_manager_t *this);
|
void (*destroy) (task_manager_t *this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an instance of the task manager.
|
|
||||||
*
|
|
||||||
* @param ike_sa IKE_SA to manage.
|
|
||||||
*/
|
|
||||||
task_manager_t *task_manager_create(ike_sa_t *ike_sa);
|
|
||||||
|
|
||||||
#endif /** TASK_MANAGER_H_ @}*/
|
#endif /** TASK_MANAGER_H_ @}*/
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* for more details.
|
* for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "task_manager.h"
|
#include "task_manager_v2.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ struct private_task_manager_t {
|
|||||||
/**
|
/**
|
||||||
* public functions
|
* public functions
|
||||||
*/
|
*/
|
||||||
task_manager_t public;
|
task_manager_v2_t public;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* associated IKE_SA we are serving
|
* associated IKE_SA we are serving
|
||||||
@@ -1106,22 +1106,24 @@ METHOD(task_manager_t, destroy, void,
|
|||||||
/*
|
/*
|
||||||
* see header file
|
* see header file
|
||||||
*/
|
*/
|
||||||
task_manager_t *task_manager_create(ike_sa_t *ike_sa)
|
task_manager_v2_t *task_manager_v2_create(ike_sa_t *ike_sa)
|
||||||
{
|
{
|
||||||
private_task_manager_t *this;
|
private_task_manager_t *this;
|
||||||
|
|
||||||
INIT(this,
|
INIT(this,
|
||||||
.public = {
|
.public = {
|
||||||
.process_message = _process_message,
|
.task_manager = {
|
||||||
.queue_task = _queue_task,
|
.process_message = _process_message,
|
||||||
.initiate = _initiate,
|
.queue_task = _queue_task,
|
||||||
.retransmit = _retransmit,
|
.initiate = _initiate,
|
||||||
.incr_mid = _incr_mid,
|
.retransmit = _retransmit,
|
||||||
.reset = _reset,
|
.incr_mid = _incr_mid,
|
||||||
.adopt_tasks = _adopt_tasks,
|
.reset = _reset,
|
||||||
.busy = _busy,
|
.adopt_tasks = _adopt_tasks,
|
||||||
.create_task_enumerator = _create_task_enumerator,
|
.busy = _busy,
|
||||||
.destroy = _destroy,
|
.create_task_enumerator = _create_task_enumerator,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
.ike_sa = ike_sa,
|
.ike_sa = ike_sa,
|
||||||
.initiating.type = EXCHANGE_TYPE_UNDEFINED,
|
.initiating.type = EXCHANGE_TYPE_UNDEFINED,
|
||||||
@@ -1138,4 +1140,3 @@ task_manager_t *task_manager_create(ike_sa_t *ike_sa)
|
|||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Martin Willi
|
||||||
|
* Copyright (C) 2011 revosec AG
|
||||||
|
*
|
||||||
|
* 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 task_manager_v2 task_manager_v2
|
||||||
|
* @{ @ingroup sa
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TASK_MANAGER_V2_H_
|
||||||
|
#define TASK_MANAGER_V2_H_
|
||||||
|
|
||||||
|
typedef struct task_manager_v2_t task_manager_v2_t;
|
||||||
|
|
||||||
|
#include <sa/task_manager.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task manager, IKEv2 variant.
|
||||||
|
*/
|
||||||
|
struct task_manager_v2_t {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements task_manager_t.
|
||||||
|
*/
|
||||||
|
task_manager_t task_manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an instance of the task manager.
|
||||||
|
*
|
||||||
|
* @param ike_sa IKE_SA to manage.
|
||||||
|
*/
|
||||||
|
task_manager_v2_t *task_manager_v2_create(ike_sa_t *ike_sa);
|
||||||
|
|
||||||
|
#endif /** TASK_MANAGER_V2_H_ @}*/
|
||||||
Reference in New Issue
Block a user