Moved scheduler and thread pool to libstrongswan.

This commit is contained in:
Tobias Brunner
2010-09-02 19:04:18 +02:00
parent 062a602216
commit e18556e9e9
15 changed files with 43 additions and 44 deletions
+1 -5
View File
@@ -11,11 +11,7 @@ attributes/mem_pool.c attributes/mem_pool.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.h \
kernel/kernel_listener.h \
processing/jobs/job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/processor.c processing/processor.h \
processing/scheduler.c processing/scheduler.h
kernel/kernel_listener.h
# adding the plugin source files
+1 -5
View File
@@ -9,11 +9,7 @@ attributes/mem_pool.c attributes/mem_pool.h \
kernel/kernel_interface.c kernel/kernel_interface.h \
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
kernel/kernel_net.h \
kernel/kernel_listener.h \
processing/jobs/job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/processor.c processing/processor.h \
processing/scheduler.c processing/scheduler.h
kernel/kernel_listener.h
libhydra_la_LIBADD =
-6
View File
@@ -43,8 +43,6 @@ void libhydra_deinit()
private_hydra_t *this = (private_hydra_t*)hydra;
this->public.attributes->destroy(this->public.attributes);
this->public.kernel_interface->destroy(this->public.kernel_interface);
this->public.scheduler->destroy(this->public.scheduler);
this->public.processor->destroy(this->public.processor);
free((void*)this->public.daemon);
free(this);
hydra = NULL;
@@ -61,15 +59,11 @@ bool libhydra_init(const char *daemon)
.public = {
.attributes = attribute_manager_create(),
.kernel_interface = kernel_interface_create(),
.processor = processor_create(),
.daemon = strdup(daemon ?: "libhydra"),
},
);
hydra = &this->public;
/* requires hydra->processor */
this->public.scheduler = scheduler_create();
if (lib->integrity &&
!lib->integrity->check(lib->integrity, "libhydra", libhydra_init))
{
-18
View File
@@ -25,12 +25,6 @@
* @defgroup hplugins plugins
* @ingroup libhydra
*
* @defgroup hprocessing processing
* @ingroup libhydra
*
* @defgroup hjobs jobs
* @ingroup hprocessing
*
* @addtogroup libhydra
* @{
*/
@@ -42,8 +36,6 @@ typedef struct hydra_t hydra_t;
#include <attributes/attribute_manager.h>
#include <kernel/kernel_interface.h>
#include <processing/processor.h>
#include <processing/scheduler.h>
#include <library.h>
@@ -62,16 +54,6 @@ struct hydra_t {
*/
kernel_interface_t *kernel_interface;
/**
* process jobs using a thread pool
*/
processor_t *processor;
/**
* schedule jobs
*/
scheduler_t *scheduler;
/**
* name of the daemon that initialized the library
*/
+6 -2
View File
@@ -50,6 +50,11 @@ credentials/cert_validator.h \
database/database.h database/database_factory.h database/database_factory.c \
fetcher/fetcher.h fetcher/fetcher_manager.h fetcher/fetcher_manager.c \
eap/eap.h eap/eap.c \
plugins/plugin_loader.c plugins/plugin_loader.h plugins/plugin.h \
processing/jobs/job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/processor.c processing/processor.h \
processing/scheduler.c processing/scheduler.h \
selectors/traffic_selector.c selectors/traffic_selector.h \
threading/thread.h threading/thread.c \
threading/thread_value.h threading/thread_value.c \
@@ -65,8 +70,7 @@ utils/linked_list.c utils/linked_list.h \
utils/hashtable.c utils/hashtable.h \
utils/enumerator.c utils/enumerator.h \
utils/optionsfrom.c utils/optionsfrom.h \
utils/backtrace.c utils/backtrace.h \
plugins/plugin_loader.c plugins/plugin_loader.h plugins/plugin.h
utils/backtrace.c utils/backtrace.h
# adding the plugin source files
+7 -2
View File
@@ -49,6 +49,11 @@ credentials/cert_validator.h \
database/database.h database/database_factory.h database/database_factory.c \
fetcher/fetcher.h fetcher/fetcher_manager.h fetcher/fetcher_manager.c \
eap/eap.h eap/eap.c \
plugins/plugin_loader.c plugins/plugin_loader.h plugins/plugin.h \
processing/jobs/job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/processor.c processing/processor.h \
processing/scheduler.c processing/scheduler.h \
selectors/traffic_selector.c selectors/traffic_selector.h \
threading/thread.h threading/thread.c \
threading/thread_value.h threading/thread_value.c \
@@ -64,8 +69,8 @@ utils/linked_list.c utils/linked_list.h \
utils/hashtable.c utils/hashtable.h \
utils/enumerator.c utils/enumerator.h \
utils/optionsfrom.c utils/optionsfrom.h \
utils/backtrace.c utils/backtrace.h \
plugins/plugin_loader.c plugins/plugin_loader.h plugins/plugin.h
utils/backtrace.c utils/backtrace.h
library.lo : $(top_builddir)/config.status
+4
View File
@@ -65,6 +65,8 @@ void library_deinit()
detailed = lib->settings->get_bool(lib->settings,
"libstrongswan.leak_detective.detailed", TRUE);
this->public.scheduler->destroy(this->public.scheduler);
this->public.processor->destroy(this->public.processor);
this->public.plugins->destroy(this->public.plugins);
this->public.settings->destroy(this->public.settings);
this->public.credmgr->destroy(this->public.credmgr);
@@ -141,6 +143,8 @@ bool library_init(char *settings)
this->public.encoding = cred_encoding_create();
this->public.fetcher = fetcher_manager_create();
this->public.db = database_factory_create();
this->public.processor = processor_create();
this->public.scheduler = scheduler_create();
this->public.plugins = plugin_loader_create();
this->public.integrity = NULL;
+18
View File
@@ -43,6 +43,12 @@
* @defgroup plugins plugins
* @ingroup libstrongswan
*
* @defgroup processing processing
* @ingroup libstrongswan
*
* @defgroup jobs jobs
* @ingroup processing
*
* @defgroup threading threading
* @ingroup libstrongswan
*
@@ -64,6 +70,8 @@
#include "settings.h"
#include "integrity_checker.h"
#include "plugins/plugin_loader.h"
#include "processing/processor.h"
#include "processing/scheduler.h"
#include "crypto/crypto_factory.h"
#include "fetcher/fetcher_manager.h"
#include "database/database_factory.h"
@@ -118,6 +126,16 @@ struct library_t {
*/
plugin_loader_t *plugins;
/**
* process jobs using a thread pool
*/
processor_t *processor;
/**
* schedule jobs
*/
scheduler_t *scheduler;
/**
* various settings loaded from settings file
*/
@@ -15,7 +15,7 @@
/**
* @defgroup callback_job callback_job
* @{ @ingroup hjobs
* @{ @ingroup jobs
*/
#ifndef CALLBACK_JOB_H_
@@ -16,7 +16,7 @@
/**
* @defgroup job job
* @{ @ingroup hjobs
* @{ @ingroup jobs
*/
#ifndef JOB_H_
@@ -16,7 +16,7 @@
/**
* @defgroup processor processor
* @{ @ingroup hprocessing
* @{ @ingroup processing
*/
#ifndef PROCESSOR_H_
@@ -51,7 +51,7 @@ struct processor_t {
/**
* Get the number of queued jobs.
*
* @returns number of items in queue
* @return number of items in queue
*/
u_int (*get_job_load) (processor_t *this);
@@ -60,7 +60,7 @@ struct processor_t {
*
* This function is non blocking and adds a job_t to the queue.
*
* @param job job to add to the queue
* @param job job to add to the queue
*/
void (*queue_job) (processor_t *this, job_t *job);
@@ -17,7 +17,7 @@
/**
* @defgroup scheduler scheduler
* @{ @ingroup hprocessing
* @{ @ingroup processing
*/
#ifndef SCHEDULER_H_