aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/Android.mk2
-rw-r--r--src/libcharon/Makefile.am2
-rw-r--r--src/libcharon/daemon.c11
-rw-r--r--src/libcharon/daemon.h6
-rw-r--r--src/libhydra/Android.mk4
-rw-r--r--src/libhydra/Makefile.am4
-rw-r--r--src/libhydra/hydra.c2
-rw-r--r--src/libhydra/hydra.h12
-rw-r--r--src/libhydra/processing/jobs/job.h (renamed from src/libcharon/processing/jobs/job.h)0
-rw-r--r--src/libhydra/processing/processor.c (renamed from src/libcharon/processing/processor.c)1
-rw-r--r--src/libhydra/processing/processor.h (renamed from src/libcharon/processing/processor.h)0
11 files changed, 23 insertions, 21 deletions
diff --git a/src/libcharon/Android.mk b/src/libcharon/Android.mk
index 3297654e9..df1b0df87 100644
--- a/src/libcharon/Android.mk
+++ b/src/libcharon/Android.mk
@@ -47,7 +47,6 @@ network/packet.c network/packet.h \
network/receiver.c network/receiver.h \
network/sender.c network/sender.h \
network/socket_manager.c network/socket_manager.h network/socket.h \
-processing/jobs/job.h \
processing/jobs/acquire_job.c processing/jobs/acquire_job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/jobs/delete_child_sa_job.c processing/jobs/delete_child_sa_job.h \
@@ -63,7 +62,6 @@ processing/jobs/roam_job.c processing/jobs/roam_job.h \
processing/jobs/update_sa_job.c processing/jobs/update_sa_job.h \
processing/jobs/inactivity_job.c processing/jobs/inactivity_job.h \
processing/scheduler.c processing/scheduler.h \
-processing/processor.c processing/processor.h \
sa/authenticators/authenticator.c sa/authenticators/authenticator.h \
sa/authenticators/eap_authenticator.c sa/authenticators/eap_authenticator.h \
sa/authenticators/eap/eap_method.c sa/authenticators/eap/eap_method.h \
diff --git a/src/libcharon/Makefile.am b/src/libcharon/Makefile.am
index 07ef13418..9fafaece8 100644
--- a/src/libcharon/Makefile.am
+++ b/src/libcharon/Makefile.am
@@ -45,7 +45,6 @@ network/packet.c network/packet.h \
network/receiver.c network/receiver.h \
network/sender.c network/sender.h \
network/socket_manager.c network/socket_manager.h network/socket.h \
-processing/jobs/job.h \
processing/jobs/acquire_job.c processing/jobs/acquire_job.h \
processing/jobs/callback_job.c processing/jobs/callback_job.h \
processing/jobs/delete_child_sa_job.c processing/jobs/delete_child_sa_job.h \
@@ -61,7 +60,6 @@ processing/jobs/roam_job.c processing/jobs/roam_job.h \
processing/jobs/update_sa_job.c processing/jobs/update_sa_job.h \
processing/jobs/inactivity_job.c processing/jobs/inactivity_job.h \
processing/scheduler.c processing/scheduler.h \
-processing/processor.c processing/processor.h \
sa/authenticators/authenticator.c sa/authenticators/authenticator.h \
sa/authenticators/eap_authenticator.c sa/authenticators/eap_authenticator.h \
sa/authenticators/eap/eap_method.c sa/authenticators/eap/eap_method.h \
diff --git a/src/libcharon/daemon.c b/src/libcharon/daemon.c
index 252c15529..2f4c1c1fa 100644
--- a/src/libcharon/daemon.c
+++ b/src/libcharon/daemon.c
@@ -94,10 +94,8 @@ static void dbg_bus(debug_t group, level_t level, char *fmt, ...)
static void destroy(private_daemon_t *this)
{
/* terminate all idle threads */
- if (this->public.processor)
- {
- this->public.processor->set_threads(this->public.processor, 0);
- }
+ hydra->processor->set_threads(hydra->processor, 0);
+
/* close all IKE_SAs */
if (this->public.ike_sa_manager)
{
@@ -123,8 +121,6 @@ static void destroy(private_daemon_t *this)
#endif /* ME */
DESTROY_IF(this->public.backends);
DESTROY_IF(this->public.socket);
- /* wait until all threads are gone */
- DESTROY_IF(this->public.processor);
/* rehook library logging, shutdown logging */
dbg = dbg_old;
@@ -176,7 +172,7 @@ METHOD(daemon_t, start, void,
private_daemon_t *this)
{
/* start the engine, go multithreaded */
- charon->processor->set_threads(charon->processor,
+ hydra->processor->set_threads(hydra->processor,
lib->settings->get_int(lib->settings, "charon.threads",
DEFAULT_THREADS));
}
@@ -361,7 +357,6 @@ METHOD(daemon_t, initialize, bool,
}
/* load secrets, ca certificates and crls */
- this->public.processor = processor_create();
this->public.scheduler = scheduler_create();
this->public.controller = controller_create();
this->public.eap = eap_manager_create();
diff --git a/src/libcharon/daemon.h b/src/libcharon/daemon.h
index 38f0256e7..30d37544c 100644
--- a/src/libcharon/daemon.h
+++ b/src/libcharon/daemon.h
@@ -141,7 +141,6 @@ typedef struct daemon_t daemon_t;
#include <network/receiver.h>
#include <network/socket_manager.h>
#include <processing/scheduler.h>
-#include <processing/processor.h>
#include <kernel/kernel_interface.h>
#include <control/controller.h>
#include <bus/bus.h>
@@ -214,11 +213,6 @@ struct daemon_t {
scheduler_t *scheduler;
/**
- * Job processing using a thread pool.
- */
- processor_t *processor;
-
- /**
* The signaling bus.
*/
bus_t *bus;
diff --git a/src/libhydra/Android.mk b/src/libhydra/Android.mk
index caad7447a..abbec9e49 100644
--- a/src/libhydra/Android.mk
+++ b/src/libhydra/Android.mk
@@ -7,7 +7,9 @@ hydra.c hydra.h \
attributes/attributes.c attributes/attributes.h \
attributes/attribute_provider.h attributes/attribute_handler.h \
attributes/attribute_manager.c attributes/attribute_manager.h \
-attributes/mem_pool.c attributes/mem_pool.h
+attributes/mem_pool.c attributes/mem_pool.h \
+processing/jobs/job.h \
+processing/processor.c processing/processor.h
# adding the plugin source files
diff --git a/src/libhydra/Makefile.am b/src/libhydra/Makefile.am
index 4e5c55d3f..78e12e0a2 100644
--- a/src/libhydra/Makefile.am
+++ b/src/libhydra/Makefile.am
@@ -5,7 +5,9 @@ hydra.c hydra.h \
attributes/attributes.c attributes/attributes.h \
attributes/attribute_provider.h attributes/attribute_handler.h \
attributes/attribute_manager.c attributes/attribute_manager.h \
-attributes/mem_pool.c attributes/mem_pool.h
+attributes/mem_pool.c attributes/mem_pool.h \
+processing/jobs/job.h \
+processing/processor.c processing/processor.h
libhydra_la_LIBADD =
diff --git a/src/libhydra/hydra.c b/src/libhydra/hydra.c
index 16a8193ea..2f3459517 100644
--- a/src/libhydra/hydra.c
+++ b/src/libhydra/hydra.c
@@ -42,6 +42,7 @@ void libhydra_deinit()
{
private_hydra_t *this = (private_hydra_t*)hydra;
this->public.attributes->destroy(this->public.attributes);
+ this->public.processor->destroy(this->public.processor);
free((void*)this->public.daemon);
free(this);
hydra = NULL;
@@ -57,6 +58,7 @@ bool libhydra_init(const char *daemon)
INIT(this,
.public = {
.attributes = attribute_manager_create(),
+ .processor = processor_create(),
.daemon = strdup(daemon ?: "libhydra"),
},
);
diff --git a/src/libhydra/hydra.h b/src/libhydra/hydra.h
index 8670f3969..da515b103 100644
--- a/src/libhydra/hydra.h
+++ b/src/libhydra/hydra.h
@@ -22,6 +22,12 @@
* @defgroup hplugins plugins
* @ingroup libhydra
*
+ * @defgroup processing processing
+ * @ingroup libhydra
+ *
+ * @defgroup jobs jobs
+ * @ingroup processing
+ *
* @addtogroup libhydra
* @{
*/
@@ -32,6 +38,7 @@
typedef struct hydra_t hydra_t;
#include <attributes/attribute_manager.h>
+#include <processing/processor.h>
#include <library.h>
@@ -46,6 +53,11 @@ struct hydra_t {
attribute_manager_t *attributes;
/**
+ * process jobs using a thread pool
+ */
+ processor_t *processor;
+
+ /**
* name of the daemon that initialized the library
*/
const char *daemon;
diff --git a/src/libcharon/processing/jobs/job.h b/src/libhydra/processing/jobs/job.h
index 0f1c16ebe..0f1c16ebe 100644
--- a/src/libcharon/processing/jobs/job.h
+++ b/src/libhydra/processing/jobs/job.h
diff --git a/src/libcharon/processing/processor.c b/src/libhydra/processing/processor.c
index d5774af26..731c9e296 100644
--- a/src/libcharon/processing/processor.c
+++ b/src/libhydra/processing/processor.c
@@ -20,7 +20,6 @@
#include "processor.h"
-#include <daemon.h>
#include <threading/thread.h>
#include <threading/condvar.h>
#include <threading/mutex.h>
diff --git a/src/libcharon/processing/processor.h b/src/libhydra/processing/processor.h
index 5bf8cf573..5bf8cf573 100644
--- a/src/libcharon/processing/processor.h
+++ b/src/libhydra/processing/processor.h