Moved scheduler and thread pool to libstrongswan.
This commit is contained in:
@@ -11,11 +11,7 @@ attributes/mem_pool.c attributes/mem_pool.h \
|
|||||||
kernel/kernel_interface.c kernel/kernel_interface.h \
|
kernel/kernel_interface.c kernel/kernel_interface.h \
|
||||||
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
|
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
|
||||||
kernel/kernel_net.h \
|
kernel/kernel_net.h \
|
||||||
kernel/kernel_listener.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
|
|
||||||
|
|
||||||
# adding the plugin source files
|
# adding the plugin source files
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ attributes/mem_pool.c attributes/mem_pool.h \
|
|||||||
kernel/kernel_interface.c kernel/kernel_interface.h \
|
kernel/kernel_interface.c kernel/kernel_interface.h \
|
||||||
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
|
kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
|
||||||
kernel/kernel_net.h \
|
kernel/kernel_net.h \
|
||||||
kernel/kernel_listener.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
|
|
||||||
|
|
||||||
libhydra_la_LIBADD =
|
libhydra_la_LIBADD =
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ void libhydra_deinit()
|
|||||||
private_hydra_t *this = (private_hydra_t*)hydra;
|
private_hydra_t *this = (private_hydra_t*)hydra;
|
||||||
this->public.attributes->destroy(this->public.attributes);
|
this->public.attributes->destroy(this->public.attributes);
|
||||||
this->public.kernel_interface->destroy(this->public.kernel_interface);
|
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((void*)this->public.daemon);
|
||||||
free(this);
|
free(this);
|
||||||
hydra = NULL;
|
hydra = NULL;
|
||||||
@@ -61,15 +59,11 @@ bool libhydra_init(const char *daemon)
|
|||||||
.public = {
|
.public = {
|
||||||
.attributes = attribute_manager_create(),
|
.attributes = attribute_manager_create(),
|
||||||
.kernel_interface = kernel_interface_create(),
|
.kernel_interface = kernel_interface_create(),
|
||||||
.processor = processor_create(),
|
|
||||||
.daemon = strdup(daemon ?: "libhydra"),
|
.daemon = strdup(daemon ?: "libhydra"),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
hydra = &this->public;
|
hydra = &this->public;
|
||||||
|
|
||||||
/* requires hydra->processor */
|
|
||||||
this->public.scheduler = scheduler_create();
|
|
||||||
|
|
||||||
if (lib->integrity &&
|
if (lib->integrity &&
|
||||||
!lib->integrity->check(lib->integrity, "libhydra", libhydra_init))
|
!lib->integrity->check(lib->integrity, "libhydra", libhydra_init))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,12 +25,6 @@
|
|||||||
* @defgroup hplugins plugins
|
* @defgroup hplugins plugins
|
||||||
* @ingroup libhydra
|
* @ingroup libhydra
|
||||||
*
|
*
|
||||||
* @defgroup hprocessing processing
|
|
||||||
* @ingroup libhydra
|
|
||||||
*
|
|
||||||
* @defgroup hjobs jobs
|
|
||||||
* @ingroup hprocessing
|
|
||||||
*
|
|
||||||
* @addtogroup libhydra
|
* @addtogroup libhydra
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
@@ -42,8 +36,6 @@ typedef struct hydra_t hydra_t;
|
|||||||
|
|
||||||
#include <attributes/attribute_manager.h>
|
#include <attributes/attribute_manager.h>
|
||||||
#include <kernel/kernel_interface.h>
|
#include <kernel/kernel_interface.h>
|
||||||
#include <processing/processor.h>
|
|
||||||
#include <processing/scheduler.h>
|
|
||||||
|
|
||||||
#include <library.h>
|
#include <library.h>
|
||||||
|
|
||||||
@@ -62,16 +54,6 @@ struct hydra_t {
|
|||||||
*/
|
*/
|
||||||
kernel_interface_t *kernel_interface;
|
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
|
* name of the daemon that initialized the library
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ credentials/cert_validator.h \
|
|||||||
database/database.h database/database_factory.h database/database_factory.c \
|
database/database.h database/database_factory.h database/database_factory.c \
|
||||||
fetcher/fetcher.h fetcher/fetcher_manager.h fetcher/fetcher_manager.c \
|
fetcher/fetcher.h fetcher/fetcher_manager.h fetcher/fetcher_manager.c \
|
||||||
eap/eap.h eap/eap.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 \
|
selectors/traffic_selector.c selectors/traffic_selector.h \
|
||||||
threading/thread.h threading/thread.c \
|
threading/thread.h threading/thread.c \
|
||||||
threading/thread_value.h threading/thread_value.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/hashtable.c utils/hashtable.h \
|
||||||
utils/enumerator.c utils/enumerator.h \
|
utils/enumerator.c utils/enumerator.h \
|
||||||
utils/optionsfrom.c utils/optionsfrom.h \
|
utils/optionsfrom.c utils/optionsfrom.h \
|
||||||
utils/backtrace.c utils/backtrace.h \
|
utils/backtrace.c utils/backtrace.h
|
||||||
plugins/plugin_loader.c plugins/plugin_loader.h plugins/plugin.h
|
|
||||||
|
|
||||||
# adding the plugin source files
|
# adding the plugin source files
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ credentials/cert_validator.h \
|
|||||||
database/database.h database/database_factory.h database/database_factory.c \
|
database/database.h database/database_factory.h database/database_factory.c \
|
||||||
fetcher/fetcher.h fetcher/fetcher_manager.h fetcher/fetcher_manager.c \
|
fetcher/fetcher.h fetcher/fetcher_manager.h fetcher/fetcher_manager.c \
|
||||||
eap/eap.h eap/eap.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 \
|
selectors/traffic_selector.c selectors/traffic_selector.h \
|
||||||
threading/thread.h threading/thread.c \
|
threading/thread.h threading/thread.c \
|
||||||
threading/thread_value.h threading/thread_value.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/hashtable.c utils/hashtable.h \
|
||||||
utils/enumerator.c utils/enumerator.h \
|
utils/enumerator.c utils/enumerator.h \
|
||||||
utils/optionsfrom.c utils/optionsfrom.h \
|
utils/optionsfrom.c utils/optionsfrom.h \
|
||||||
utils/backtrace.c utils/backtrace.h \
|
utils/backtrace.c utils/backtrace.h
|
||||||
plugins/plugin_loader.c plugins/plugin_loader.h plugins/plugin.h
|
|
||||||
|
|
||||||
library.lo : $(top_builddir)/config.status
|
library.lo : $(top_builddir)/config.status
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ void library_deinit()
|
|||||||
detailed = lib->settings->get_bool(lib->settings,
|
detailed = lib->settings->get_bool(lib->settings,
|
||||||
"libstrongswan.leak_detective.detailed", TRUE);
|
"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.plugins->destroy(this->public.plugins);
|
||||||
this->public.settings->destroy(this->public.settings);
|
this->public.settings->destroy(this->public.settings);
|
||||||
this->public.credmgr->destroy(this->public.credmgr);
|
this->public.credmgr->destroy(this->public.credmgr);
|
||||||
@@ -141,6 +143,8 @@ bool library_init(char *settings)
|
|||||||
this->public.encoding = cred_encoding_create();
|
this->public.encoding = cred_encoding_create();
|
||||||
this->public.fetcher = fetcher_manager_create();
|
this->public.fetcher = fetcher_manager_create();
|
||||||
this->public.db = database_factory_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.plugins = plugin_loader_create();
|
||||||
this->public.integrity = NULL;
|
this->public.integrity = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,12 @@
|
|||||||
* @defgroup plugins plugins
|
* @defgroup plugins plugins
|
||||||
* @ingroup libstrongswan
|
* @ingroup libstrongswan
|
||||||
*
|
*
|
||||||
|
* @defgroup processing processing
|
||||||
|
* @ingroup libstrongswan
|
||||||
|
*
|
||||||
|
* @defgroup jobs jobs
|
||||||
|
* @ingroup processing
|
||||||
|
*
|
||||||
* @defgroup threading threading
|
* @defgroup threading threading
|
||||||
* @ingroup libstrongswan
|
* @ingroup libstrongswan
|
||||||
*
|
*
|
||||||
@@ -64,6 +70,8 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "integrity_checker.h"
|
#include "integrity_checker.h"
|
||||||
#include "plugins/plugin_loader.h"
|
#include "plugins/plugin_loader.h"
|
||||||
|
#include "processing/processor.h"
|
||||||
|
#include "processing/scheduler.h"
|
||||||
#include "crypto/crypto_factory.h"
|
#include "crypto/crypto_factory.h"
|
||||||
#include "fetcher/fetcher_manager.h"
|
#include "fetcher/fetcher_manager.h"
|
||||||
#include "database/database_factory.h"
|
#include "database/database_factory.h"
|
||||||
@@ -118,6 +126,16 @@ struct library_t {
|
|||||||
*/
|
*/
|
||||||
plugin_loader_t *plugins;
|
plugin_loader_t *plugins;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* process jobs using a thread pool
|
||||||
|
*/
|
||||||
|
processor_t *processor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* schedule jobs
|
||||||
|
*/
|
||||||
|
scheduler_t *scheduler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* various settings loaded from settings file
|
* various settings loaded from settings file
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup callback_job callback_job
|
* @defgroup callback_job callback_job
|
||||||
* @{ @ingroup hjobs
|
* @{ @ingroup jobs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CALLBACK_JOB_H_
|
#ifndef CALLBACK_JOB_H_
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup job job
|
* @defgroup job job
|
||||||
* @{ @ingroup hjobs
|
* @{ @ingroup jobs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef JOB_H_
|
#ifndef JOB_H_
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup processor processor
|
* @defgroup processor processor
|
||||||
* @{ @ingroup hprocessing
|
* @{ @ingroup processing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PROCESSOR_H_
|
#ifndef PROCESSOR_H_
|
||||||
@@ -51,7 +51,7 @@ struct processor_t {
|
|||||||
/**
|
/**
|
||||||
* Get the number of queued jobs.
|
* 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);
|
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.
|
* 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);
|
void (*queue_job) (processor_t *this, job_t *job);
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup scheduler scheduler
|
* @defgroup scheduler scheduler
|
||||||
* @{ @ingroup hprocessing
|
* @{ @ingroup processing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SCHEDULER_H_
|
#ifndef SCHEDULER_H_
|
||||||
Reference in New Issue
Block a user