summaryrefslogtreecommitdiff
path: root/src/charon/processing
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2008-07-10 12:47:56 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2008-07-10 12:47:56 +0000
commiteb841c5ef668a48782ef1154fda65cb6048f5885 (patch)
tree00dd0cb4313bf2291d94ed511fe51f0b4bc7ea7a /src/charon/processing
parent738206039047924ae7e4762a53d121be1ca43000 (diff)
downloadvyos-strongswan-eb841c5ef668a48782ef1154fda65cb6048f5885.tar.gz
vyos-strongswan-eb841c5ef668a48782ef1154fda65cb6048f5885.zip
- Updated to new upstream.
Diffstat (limited to 'src/charon/processing')
-rw-r--r--src/charon/processing/jobs/acquire_job.c9
-rw-r--r--src/charon/processing/jobs/acquire_job.h27
-rw-r--r--src/charon/processing/jobs/callback_job.c16
-rw-r--r--src/charon/processing/jobs/callback_job.h44
-rw-r--r--src/charon/processing/jobs/delete_child_sa_job.c9
-rw-r--r--src/charon/processing/jobs/delete_child_sa_job.h27
-rw-r--r--src/charon/processing/jobs/delete_ike_sa_job.c9
-rw-r--r--src/charon/processing/jobs/delete_ike_sa_job.h27
-rw-r--r--src/charon/processing/jobs/initiate_mediation_job.c31
-rw-r--r--src/charon/processing/jobs/initiate_mediation_job.h37
-rw-r--r--src/charon/processing/jobs/job.h33
-rw-r--r--src/charon/processing/jobs/mediation_job.c36
-rw-r--r--src/charon/processing/jobs/mediation_job.h36
-rw-r--r--src/charon/processing/jobs/process_message_job.c14
-rw-r--r--src/charon/processing/jobs/process_message_job.h27
-rw-r--r--src/charon/processing/jobs/rekey_child_sa_job.c9
-rw-r--r--src/charon/processing/jobs/rekey_child_sa_job.h32
-rw-r--r--src/charon/processing/jobs/rekey_ike_sa_job.c14
-rw-r--r--src/charon/processing/jobs/rekey_ike_sa_job.h27
-rw-r--r--src/charon/processing/jobs/retransmit_job.c9
-rw-r--r--src/charon/processing/jobs/retransmit_job.h27
-rw-r--r--src/charon/processing/jobs/roam_job.c20
-rw-r--r--src/charon/processing/jobs/roam_job.h27
-rw-r--r--src/charon/processing/jobs/send_dpd_job.c10
-rw-r--r--src/charon/processing/jobs/send_dpd_job.h26
-rw-r--r--src/charon/processing/jobs/send_keepalive_job.c10
-rw-r--r--src/charon/processing/jobs/send_keepalive_job.h26
-rw-r--r--src/charon/processing/processor.c49
-rw-r--r--src/charon/processing/processor.h51
-rw-r--r--src/charon/processing/scheduler.c9
-rw-r--r--src/charon/processing/scheduler.h38
31 files changed, 274 insertions, 492 deletions
diff --git a/src/charon/processing/jobs/acquire_job.c b/src/charon/processing/jobs/acquire_job.c
index 48a77f558..b39e8e680 100644
--- a/src/charon/processing/jobs/acquire_job.c
+++ b/src/charon/processing/jobs/acquire_job.c
@@ -1,10 +1,3 @@
-/**
- * @file acquire_job.c
- *
- * @brief Implementation of acquire_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,8 @@
* 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.
+ *
+ * $Id: acquire_job.c 3589 2008-03-13 14:14:44Z martin $
*/
#include "acquire_job.h"
diff --git a/src/charon/processing/jobs/acquire_job.h b/src/charon/processing/jobs/acquire_job.h
index 226966215..17c993d8e 100644
--- a/src/charon/processing/jobs/acquire_job.h
+++ b/src/charon/processing/jobs/acquire_job.h
@@ -1,10 +1,3 @@
-/**
- * @file acquire_job.h
- *
- * @brief Interface of acquire_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,13 @@
* 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.
+ *
+ * $Id: acquire_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup acquire_job acquire_job
+ * @{ @ingroup jobs
*/
#ifndef ACQUIRE_JOB_H_
@@ -29,14 +29,9 @@ typedef struct acquire_job_t acquire_job_t;
#include <processing/jobs/job.h>
/**
- * @brief Class representing an ACQUIRE Job.
+ * Class representing an ACQUIRE Job.
*
* This job initiates a CHILD SA on kernel request.
- *
- * @b Constructors:
- * - acquire_job_create()
- *
- * @ingroup jobs
*/
struct acquire_job_t {
/**
@@ -46,15 +41,13 @@ struct acquire_job_t {
};
/**
- * @brief Creates a job of type ACQUIRE.
+ * Creates a job of type ACQUIRE.
*
* We use the reqid to find the routed CHILD_SA.
*
* @param reqid reqid of the CHILD_SA to acquire
* @return acquire_job_t object
- *
- * @ingroup jobs
*/
acquire_job_t *acquire_job_create(u_int32_t reqid);
-#endif /* REKEY_CHILD_SA_JOB_H_ */
+#endif /* REKEY_CHILD_SA_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/callback_job.c b/src/charon/processing/jobs/callback_job.c
index 53297916e..e8892ee82 100644
--- a/src/charon/processing/jobs/callback_job.c
+++ b/src/charon/processing/jobs/callback_job.c
@@ -1,10 +1,3 @@
-/**
- * @file callback_job.c
- *
- * @brief Implementation of callback_job_t.
- *
- */
-
/*
* Copyright (C) 2007 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,8 @@
* 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.
+ *
+ * $Id: callback_job.c 3742 2008-04-03 09:19:12Z tobias $
*/
#include "callback_job.h"
@@ -61,11 +56,6 @@ struct private_callback_job_t {
pthread_mutex_t mutex;
/**
- * condvar to synchronize thread startup/cancellation
- */
- pthread_cond_t condvar;
-
- /**
* list of asociated child jobs
*/
linked_list_t *children;
@@ -145,7 +135,6 @@ static void execute(private_callback_job_t *this)
pthread_mutex_lock(&this->mutex);
this->thread = pthread_self();
- pthread_cond_signal(&this->condvar);
pthread_mutex_unlock(&this->mutex);
pthread_cleanup_push((void*)destroy, this);
@@ -192,7 +181,6 @@ callback_job_t *callback_job_create(callback_job_cb_t cb, void *data,
/* private variables */
pthread_mutex_init(&this->mutex, NULL);
- pthread_cond_init(&this->condvar, NULL);
this->callback = cb;
this->data = data;
this->cleanup = cleanup;
diff --git a/src/charon/processing/jobs/callback_job.h b/src/charon/processing/jobs/callback_job.h
index 169f2d207..4e2eab235 100644
--- a/src/charon/processing/jobs/callback_job.h
+++ b/src/charon/processing/jobs/callback_job.h
@@ -1,10 +1,3 @@
-/**
- * @file callback_job.h
- *
- * @brief Interface of callback_job_t.
- *
- */
-
/*
* Copyright (C) 2007 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,13 @@
* 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.
+ *
+ * $Id: callback_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup callback_job callback_job
+ * @{ @ingroup jobs
*/
#ifndef CALLBACK_JOB_H_
@@ -32,12 +32,10 @@ typedef struct callback_job_t callback_job_t;
typedef enum job_requeue_t job_requeue_t;
/**
- * @brief Job requeueing policy
+ * Job requeueing policy
*
* The job requeueing policy defines how a job is handled when the callback
* function returns.
- *
- * @ingroup jobs
*/
enum job_requeue_t {
@@ -58,20 +56,18 @@ enum job_requeue_t {
};
/**
- * @brief The callback function to use for the callback job.
+ * The callback function to use for the callback job.
*
* This is the function to use as callback for a callback job. It receives
* a parameter supplied to the callback jobs constructor.
*
* @param data param supplied to job
* @return requeing policy how to requeue the job
- *
- * @ingroup jobs
*/
typedef job_requeue_t (*callback_job_cb_t)(void *data);
/**
- * @brief Cleanup function to use for data cleanup.
+ * Cleanup function to use for data cleanup.
*
* The callback has an optional user argument which receives data. However,
* this data may be cleaned up if it is allocated. This is the function
@@ -79,22 +75,15 @@ typedef job_requeue_t (*callback_job_cb_t)(void *data);
*
* @param data param supplied to job
* @return requeing policy how to requeue the job
- *
- * @ingroup jobs
*/
typedef void (*callback_job_cleanup_t)(void *data);
/**
- * @brief Class representing an callback Job.
+ * Class representing an callback Job.
*
* This is a special job which allows a simple callback function to
* be executed by a thread of the thread pool. This allows simple execution
* of asynchronous methods, without to manage threads.
- *
- * @b Constructors:
- * - callback_job_create()
- *
- * @ingroup jobs
*/
struct callback_job_t {
/**
@@ -103,15 +92,13 @@ struct callback_job_t {
job_t job_interface;
/**
- * @brief Cancel the jobs thread and wait for its termination.
- *
- * @param this calling object
+ * Cancel the jobs thread and wait for its termination.
*/
void (*cancel)(callback_job_t *this);
};
/**
- * @brief Creates a callback job.
+ * Creates a callback job.
*
* The cleanup function is called when the job gets destroyed to destroy
* the associated data.
@@ -124,12 +111,9 @@ struct callback_job_t {
* @param cleanup destructor for data on destruction, or NULL
* @param parent parent of this job
* @return callback_job_t object
- *
- * @ingroup jobs
*/
callback_job_t *callback_job_create(callback_job_cb_t cb, void *data,
callback_job_cleanup_t cleanup,
callback_job_t *parent);
-#endif /* CALLBACK_JOB_H_ */
-
+#endif /* CALLBACK_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/delete_child_sa_job.c b/src/charon/processing/jobs/delete_child_sa_job.c
index 23f330293..26f538d67 100644
--- a/src/charon/processing/jobs/delete_child_sa_job.c
+++ b/src/charon/processing/jobs/delete_child_sa_job.c
@@ -1,10 +1,3 @@
-/**
- * @file delete_child_sa_job.c
- *
- * @brief Implementation of delete_child_sa_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,8 @@
* 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.
+ *
+ * $Id: delete_child_sa_job.c 3589 2008-03-13 14:14:44Z martin $
*/
#include "delete_child_sa_job.h"
diff --git a/src/charon/processing/jobs/delete_child_sa_job.h b/src/charon/processing/jobs/delete_child_sa_job.h
index 0b90e008d..c11e8fab4 100644
--- a/src/charon/processing/jobs/delete_child_sa_job.h
+++ b/src/charon/processing/jobs/delete_child_sa_job.h
@@ -1,10 +1,3 @@
-/**
- * @file delete_child_sa_job.h
- *
- * @brief Interface of delete_child_sa_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,13 @@
* 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.
+ *
+ * $Id: delete_child_sa_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup delete_child_sa_job delete_child_sa_job
+ * @{ @ingroup jobs
*/
#ifndef DELETE_CHILD_SA_JOB_H_
@@ -32,14 +32,9 @@ typedef struct delete_child_sa_job_t delete_child_sa_job_t;
/**
- * @brief Class representing an DELETE_CHILD_SA Job.
+ * Class representing an DELETE_CHILD_SA Job.
*
* This job initiates the delete of a CHILD SA.
- *
- * @b Constructors:
- * - delete_child_sa_job_create()
- *
- * @ingroup jobs
*/
struct delete_child_sa_job_t {
/**
@@ -49,7 +44,7 @@ struct delete_child_sa_job_t {
};
/**
- * @brief Creates a job of type DELETE_CHILD_SA.
+ * Creates a job of type DELETE_CHILD_SA.
*
* The CHILD_SA is identified by its reqid, protocol (AH/ESP) and its
* inbound SPI.
@@ -58,11 +53,9 @@ struct delete_child_sa_job_t {
* @param protocol protocol of the CHILD_SA
* @param spi security parameter index of the CHILD_SA
* @return delete_child_sa_job_t object
- *
- * @ingroup jobs
*/
delete_child_sa_job_t *delete_child_sa_job_create(u_int32_t reqid,
protocol_id_t protocol,
u_int32_t spi);
-#endif /* DELETE_CHILD_SA_JOB_H_ */
+#endif /* DELETE_CHILD_SA_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/delete_ike_sa_job.c b/src/charon/processing/jobs/delete_ike_sa_job.c
index 8d8c0cf36..95b60ad01 100644
--- a/src/charon/processing/jobs/delete_ike_sa_job.c
+++ b/src/charon/processing/jobs/delete_ike_sa_job.c
@@ -1,10 +1,3 @@
-/**
- * @file delete_ike_sa_job.c
- *
- * @brief Implementation of delete_ike_sa_job_t.
- *
- */
-
/*
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,8 @@
* 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.
+ *
+ * $Id: delete_ike_sa_job.c 3589 2008-03-13 14:14:44Z martin $
*/
#include "delete_ike_sa_job.h"
diff --git a/src/charon/processing/jobs/delete_ike_sa_job.h b/src/charon/processing/jobs/delete_ike_sa_job.h
index 11bb46e73..cf666bb48 100644
--- a/src/charon/processing/jobs/delete_ike_sa_job.h
+++ b/src/charon/processing/jobs/delete_ike_sa_job.h
@@ -1,10 +1,3 @@
-/**
- * @file delete_ike_sa_job.h
- *
- * @brief Interface of delete_ike_sa_job_t.
- *
- */
-
/*
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,13 @@
* 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.
+ *
+ * $Id: delete_ike_sa_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup delete_child_sa_job delete_child_sa_job
+ * @{ @ingroup jobs
*/
#ifndef DELETE_IKE_SA_JOB_H_
@@ -32,16 +32,11 @@ typedef struct delete_ike_sa_job_t delete_ike_sa_job_t;
/**
- * @brief Class representing an DELETE_IKE_SA Job.
+ * Class representing an DELETE_IKE_SA Job.
*
* This job is responsible for deleting established or half open IKE_SAs.
* A half open IKE_SA is every IKE_SA which hasn't reache the SA_ESTABLISHED
* state.
- *
- * @b Constructors:
- * - delete_ike_sa_job_create()
- *
- * @ingroup jobs
*/
struct delete_ike_sa_job_t {
@@ -52,15 +47,13 @@ struct delete_ike_sa_job_t {
};
/**
- * @brief Creates a job of type DELETE_IKE_SA.
+ * Creates a job of type DELETE_IKE_SA.
*
* @param ike_sa_id id of the IKE_SA to delete
* @param delete_if_established should the IKE_SA be deleted if it is established?
* @return created delete_ike_sa_job_t object
- *
- * @ingroup jobs
*/
delete_ike_sa_job_t *delete_ike_sa_job_create(ike_sa_id_t *ike_sa_id,
bool delete_if_established);
-#endif /* DELETE_IKE_SA_JOB_H_ */
+#endif /* DELETE_IKE_SA_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/initiate_mediation_job.c b/src/charon/processing/jobs/initiate_mediation_job.c
index b8d516e22..de97daafa 100644
--- a/src/charon/processing/jobs/initiate_mediation_job.c
+++ b/src/charon/processing/jobs/initiate_mediation_job.c
@@ -1,12 +1,5 @@
-/**
- * @file initiate_mediation_job.c
- *
- * @brief Implementation of initiate_mediation_job_t.
- *
- */
-
/*
- * Copyright (C) 2007 Tobias Brunner
+ * Copyright (C) 2007-2008 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -18,9 +11,10 @@
* 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.
+ *
+ * $Id: initiate_mediation_job.c 3792 2008-04-10 12:51:04Z tobias $
*/
-
#include "initiate_mediation_job.h"
#include <sa/ike_sa.h>
@@ -44,11 +38,6 @@ struct private_initiate_mediation_job_t {
ike_sa_id_t *mediated_sa_id;
/**
- * Child config of the CHILD_SA of the mediated connection.
- */
- child_cfg_t *mediated_child;
-
- /**
* ID of the IKE_SA of the mediation connection.
*/
ike_sa_id_t *mediation_sa_id;
@@ -61,7 +50,6 @@ static void destroy(private_initiate_mediation_job_t *this)
{
DESTROY_IF(this->mediation_sa_id);
DESTROY_IF(this->mediated_sa_id);
- DESTROY_IF(this->mediated_child);
free(this);
}
@@ -100,11 +88,12 @@ static void initiate(private_initiate_mediation_job_t *this)
charon->ike_sa_manager->checkin(charon->ike_sa_manager, mediated_sa);
mediation_cfg = mediated_cfg->get_mediated_by(mediated_cfg);
+ mediation_cfg->get_ref(mediation_cfg);
if (charon->connect_manager->check_and_register(charon->connect_manager,
mediation_cfg->get_my_id(mediation_cfg),
mediated_cfg->get_peer_id(mediated_cfg),
- this->mediated_sa_id, this->mediated_child))
+ this->mediated_sa_id))
{
mediated_cfg->destroy(mediated_cfg);
mediation_cfg->destroy(mediation_cfg);
@@ -121,8 +110,8 @@ static void initiate(private_initiate_mediation_job_t *this)
* we do not check the status, but NEED_MORE would be returned on success
* because the registered callback returns FALSE then
* this->mediation_sa_id is set in the callback */
- charon->interfaces->initiate(charon->interfaces,
- mediation_cfg, NULL, (interface_manager_cb_t)initiate_callback, this);
+ charon->controller->initiate(charon->controller,
+ mediation_cfg, NULL, (controller_cb_t)initiate_callback, this);
if (!this->mediation_sa_id)
{
DBG1(DBG_JOB, "initiating mediation connection '%s' failed",
@@ -216,7 +205,6 @@ static private_initiate_mediation_job_t *initiate_mediation_job_create_empty()
/* private variables */
this->mediation_sa_id = NULL;
this->mediated_sa_id = NULL;
- this->mediated_child = NULL;
return this;
}
@@ -224,16 +212,13 @@ static private_initiate_mediation_job_t *initiate_mediation_job_create_empty()
/*
* Described in header
*/
-initiate_mediation_job_t *initiate_mediation_job_create(ike_sa_id_t *ike_sa_id,
- child_cfg_t *child_cfg)
+initiate_mediation_job_t *initiate_mediation_job_create(ike_sa_id_t *ike_sa_id)
{
private_initiate_mediation_job_t *this = initiate_mediation_job_create_empty();
this->public.job_interface.execute = (void (*) (job_t *)) initiate;
this->mediated_sa_id = ike_sa_id->clone(ike_sa_id);
- child_cfg->get_ref(child_cfg);
- this->mediated_child = child_cfg;
return &this->public;
}
diff --git a/src/charon/processing/jobs/initiate_mediation_job.h b/src/charon/processing/jobs/initiate_mediation_job.h
index 9fb3b0f7d..966da95d3 100644
--- a/src/charon/processing/jobs/initiate_mediation_job.h
+++ b/src/charon/processing/jobs/initiate_mediation_job.h
@@ -1,11 +1,5 @@
-/**
- * @file initiate_mediation_job.h
- *
- * @brief Interface of initiate_mediation_job_t.
- */
-
/*
- * Copyright (C) 2007 Tobias Brunner
+ * Copyright (C) 2007-2008 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -17,6 +11,13 @@
* 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.
+ *
+ * $Id: initiate_mediation_job.h 3792 2008-04-10 12:51:04Z tobias $
+ */
+
+/**
+ * @defgroup initiate_mediation_job initiate_mediation_job
+ * @{ @ingroup jobs
*/
#ifndef INITIATE_MEDIATION_JOB_H_
@@ -25,19 +26,13 @@
typedef struct initiate_mediation_job_t initiate_mediation_job_t;
#include <processing/jobs/job.h>
-#include <config/child_cfg.h>
#include <sa/ike_sa_id.h>
/**
- * @brief Class representing a INITIATE_MEDIATION Job.
+ * Class representing a INITIATE_MEDIATION Job.
*
* This job will initiate a mediation on behalf of a mediated connection.
* If required the mediation connection is established.
- *
- * @b Constructors:
- * - initiate_mediation_job_create()
- *
- * @ingroup jobs
*/
struct initiate_mediation_job_t {
/**
@@ -47,28 +42,22 @@ struct initiate_mediation_job_t {
};
/**
- * @brief Creates a job of type INITIATE_MEDIATION.
+ * Creates a job of type INITIATE_MEDIATION.
*
* @param ike_sa_id identification of the ike_sa as ike_sa_id_t object (gets cloned)
- * @param child_cfg child config of the child_sa (gets cloned)
* @return job object
- *
- * @ingroup jobs
*/
-initiate_mediation_job_t *initiate_mediation_job_create(ike_sa_id_t *ike_sa_id,
- child_cfg_t *child_cfg);
+initiate_mediation_job_t *initiate_mediation_job_create(ike_sa_id_t *ike_sa_id);
/**
- * @brief Creates a special job of type INITIATE_MEDIATION that reinitiates a
+ * Creates a special job of type INITIATE_MEDIATION that reinitiates a
* specific connection.
*
* @param mediation_sa_id identification of the mediation sa (gets cloned)
* @param mediated_sa_id identification of the mediated sa (gets cloned)
* @return job object
- *
- * @ingroup jobs
*/
initiate_mediation_job_t *reinitiate_mediation_job_create(ike_sa_id_t *mediation_sa_id,
ike_sa_id_t *mediated_sa_id);
-#endif /*INITIATE_MEDIATION_JOB_H_*/
+#endif /*INITIATE_MEDIATION_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/job.h b/src/charon/processing/jobs/job.h
index 1826c53b4..61f639936 100644
--- a/src/charon/processing/jobs/job.h
+++ b/src/charon/processing/jobs/job.h
@@ -1,10 +1,3 @@
-/**
- * @file job.h
- *
- * @brief Interface job_t.
- *
- */
-
/*
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,13 @@
* 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.
+ *
+ * $Id: job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup job job
+ * @{ @ingroup jobs
*/
#ifndef JOB_H_
@@ -28,38 +28,27 @@ typedef struct job_t job_t;
#include <library.h>
-
/**
- * @brief Job-Interface as it is stored in the job queue.
- *
- * @b Constructors:
- * - None, use specific implementation of the interface.
- *
- * @ingroup jobs
+ * Job-Interface as it is stored in the job queue.
*/
struct job_t {
/**
- * @brief Execute a job.
+ * Execute a job.
*
* The processing facility executes a job using this method. Jobs are
* one-shot, they destroy themself after execution, so don't use a job
* once it has been executed.
- *
- * @param this calling object
*/
void (*execute) (job_t *this);
/**
- * @brief Destroy a job.
+ * Destroy a job.
*
* Is only called whenever a job was not executed (e.g. due daemon shutdown).
* After execution, jobs destroy themself.
- *
- * @param job_t calling object
*/
void (*destroy) (job_t *job);
};
-#endif /* JOB_H_ */
-
+#endif /* JOB_H_ @} */
diff --git a/src/charon/processing/jobs/mediation_job.c b/src/charon/processing/jobs/mediation_job.c
index 3b9d363d7..c177d8db3 100644
--- a/src/charon/processing/jobs/mediation_job.c
+++ b/src/charon/processing/jobs/mediation_job.c
@@ -1,10 +1,3 @@
-/**
- * @file mediation_job.c
- *
- * @brief Implementation of mediation_job_t.
- *
- */
-
/*
* Copyright (C) 2007 Tobias Brunner
* Hochschule fuer Technik Rapperswil
@@ -18,9 +11,10 @@
* 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.
+ *
+ * $Id: mediation_job.c 3666 2008-03-26 18:40:19Z tobias $
*/
-
#include "mediation_job.h"
#include <encoding/payloads/endpoint_notify.h>
@@ -49,14 +43,14 @@ struct private_mediation_job_t {
identification_t *source;
/**
- * P2P_SESSIONID
+ * ME_CONNECTID
*/
- chunk_t session_id;
+ chunk_t connect_id;
/**
- * P2P_SESSIONKEY
+ * ME_CONNECTKEY
*/
- chunk_t session_key;
+ chunk_t connect_key;
/**
* Submitted endpoints
@@ -81,8 +75,8 @@ static void destroy(private_mediation_job_t *this)
{
DESTROY_IF(this->target);
DESTROY_IF(this->source);
- chunk_free(&this->session_id);
- chunk_free(&this->session_key);
+ chunk_free(&this->connect_id);
+ chunk_free(&this->connect_key);
DESTROY_OFFSET_IF(this->endpoints, offsetof(endpoint_notify_t, destroy));
free(this);
}
@@ -117,8 +111,8 @@ static void execute(private_mediation_job_t *this)
else
{
/* normal mediation between two peers */
- if (target_sa->relay(target_sa, this->source, this->session_id,
- this->session_key, this->endpoints, this->response) != SUCCESS)
+ if (target_sa->relay(target_sa, this->source, this->connect_id,
+ this->connect_key, this->endpoints, this->response) != SUCCESS)
{
DBG1(DBG_JOB, "mediation between '%D' and '%D' failed",
this->source, this->target);
@@ -160,8 +154,8 @@ static private_mediation_job_t *mediation_job_create_empty()
this->target = NULL;
this->source = NULL;
this->callback = FALSE;
- this->session_id = chunk_empty;
- this->session_key = chunk_empty;
+ this->connect_id = chunk_empty;
+ this->connect_key = chunk_empty;
this->endpoints = NULL;
this->response = FALSE;
@@ -172,15 +166,15 @@ static private_mediation_job_t *mediation_job_create_empty()
* Described in header
*/
mediation_job_t *mediation_job_create(identification_t *peer_id,
- identification_t *requester, chunk_t session_id, chunk_t session_key,
+ identification_t *requester, chunk_t connect_id, chunk_t connect_key,
linked_list_t *endpoints, bool response)
{
private_mediation_job_t *this = mediation_job_create_empty();
this->target = peer_id->clone(peer_id);
this->source = requester->clone(requester);
- this->session_id = chunk_clone(session_id);
- this->session_key = chunk_clone(session_key);
+ this->connect_id = chunk_clone(connect_id);
+ this->connect_key = chunk_clone(connect_key);
this->endpoints = endpoints->clone_offset(endpoints, offsetof(endpoint_notify_t, clone));
this->response = response;
diff --git a/src/charon/processing/jobs/mediation_job.h b/src/charon/processing/jobs/mediation_job.h
index 6130b2e27..0e2901180 100644
--- a/src/charon/processing/jobs/mediation_job.h
+++ b/src/charon/processing/jobs/mediation_job.h
@@ -1,9 +1,3 @@
-/**
- * @file mediation_job.h
- *
- * @brief Interface of mediation_job_t.
- */
-
/*
* Copyright (C) 2007 Tobias Brunner
* Hochschule fuer Technik Rapperswil
@@ -17,6 +11,13 @@
* 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.
+ *
+ * $Id: mediation_job.h 3666 2008-03-26 18:40:19Z tobias $
+ */
+
+/**
+ * @defgroup mediation_job mediation_job
+ * @{ @ingroup jobs
*/
#ifndef MEDIATION_JOB_H_
@@ -30,14 +31,9 @@ typedef struct mediation_job_t mediation_job_t;
#include <utils/linked_list.h>
/**
- * @brief Class representing a MEDIATION Job.
+ * Class representing a MEDIATION Job.
*
* This job handles the mediation on the mediation server.
- *
- * @b Constructors:
- * - mediation_job_create()
- *
- * @ingroup jobs
*/
struct mediation_job_t {
/**
@@ -47,27 +43,25 @@ struct mediation_job_t {
};
/**
- * @brief Creates a job of type MEDIATION.
+ * Creates a job of type MEDIATION.
*
* Parameters get cloned.
*
* @param peer_id ID of the requested peer
* @param requester ID of the requesting peer
- * @param session_id content of P2P_SESSIONID (could be NULL)
- * @param session_key content of P2P_SESSIONKEY
+ * @param connect_id content of ME_CONNECTID (could be NULL)
+ * @param connect_key content of ME_CONNECTKEY
* @param endpoints list of submitted endpoints
* @param response TRUE if this is a response
* @return job object
- *
- * @ingroup jobs
*/
mediation_job_t *mediation_job_create(identification_t *peer_id,
- identification_t *requester, chunk_t session_id, chunk_t session_key,
+ identification_t *requester, chunk_t connect_id, chunk_t connect_key,
linked_list_t *endpoints, bool response);
/**
- * @brief Creates a special job of type MEDIATION that is used to send a callback
+ * Creates a special job of type MEDIATION that is used to send a callback
* notification to a peer.
*
* Parameters get cloned.
@@ -75,10 +69,8 @@ mediation_job_t *mediation_job_create(identification_t *peer_id,
* @param requester ID of the waiting peer
* @param peer_id ID of the requested peer
* @return job object
- *
- * @ingroup jobs
*/
mediation_job_t *mediation_callback_job_create(identification_t *requester,
identification_t *peer_id);
-#endif /*MEDIATION_JOB_H_*/
+#endif /*MEDIATION_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/process_message_job.c b/src/charon/processing/jobs/process_message_job.c
index 91e7a80bf..33bcae6f0 100644
--- a/src/charon/processing/jobs/process_message_job.c
+++ b/src/charon/processing/jobs/process_message_job.c
@@ -1,10 +1,3 @@
-/**
- * @file process_message_job.h
- *
- * @brief Implementation of process_message_job_t.
- *
- */
-
/*
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,9 +12,10 @@
* 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.
+ *
+ * $Id: process_message_job.c 3666 2008-03-26 18:40:19Z tobias $
*/
-
#include "process_message_job.h"
#include <daemon.h>
@@ -59,7 +53,7 @@ static void execute(private_process_message_job_t *this)
{
ike_sa_t *ike_sa;
-#ifdef P2P
+#ifdef ME
/* if this is an unencrypted INFORMATIONAL exchange it is likely a
* connectivity check. */
if (this->message->get_exchange_type(this->message) == INFORMATIONAL &&
@@ -74,7 +68,7 @@ static void execute(private_process_message_job_t *this)
destroy(this);
return;
}
-#endif /* P2P */
+#endif /* ME */
ike_sa = charon->ike_sa_manager->checkout_by_message(charon->ike_sa_manager,
this->message);
diff --git a/src/charon/processing/jobs/process_message_job.h b/src/charon/processing/jobs/process_message_job.h
index 5bb18155a..920444db1 100644
--- a/src/charon/processing/jobs/process_message_job.h
+++ b/src/charon/processing/jobs/process_message_job.h
@@ -1,10 +1,3 @@
-/**
- * @file process_message_job.h
- *
- * @brief Interface of process_message_job_t.
- *
- */
-
/*
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,13 @@
* 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.
+ *
+ * $Id: process_message_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup process_message_job process_message_job
+ * @{ @ingroup jobs
*/
#ifndef PROCESS_MESSAGE_JOB_H_
@@ -31,12 +31,7 @@ typedef struct process_message_job_t process_message_job_t;
#include <processing/jobs/job.h>
/**
- * @brief Class representing an PROCESS_MESSAGE job.
- *
- * @b Constructors:
- * - process_message_job_create()
- *
- * @ingroup jobs
+ * Class representing an PROCESS_MESSAGE job.
*/
struct process_message_job_t {
/**
@@ -46,13 +41,11 @@ struct process_message_job_t {
};
/**
- * @brief Creates a job of type PROCESS_MESSAGE.
+ * Creates a job of type PROCESS_MESSAGE.
*
* @param message message to process
* @return created process_message_job_t object
- *
- * @ingroup jobs
*/
process_message_job_t *process_message_job_create(message_t *message);
-#endif /*PROCESS_MESSAGE_JOB_H_*/
+#endif /*PROCESS_MESSAGE_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/rekey_child_sa_job.c b/src/charon/processing/jobs/rekey_child_sa_job.c
index f754e5a1f..42bf79d26 100644
--- a/src/charon/processing/jobs/rekey_child_sa_job.c
+++ b/src/charon/processing/jobs/rekey_child_sa_job.c
@@ -1,10 +1,3 @@
-/**
- * @file rekey_child_sa_job.c
- *
- * @brief Implementation of rekey_child_sa_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,8 @@
* 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.
+ *
+ * $Id: rekey_child_sa_job.c 3589 2008-03-13 14:14:44Z martin $
*/
#include "rekey_child_sa_job.h"
diff --git a/src/charon/processing/jobs/rekey_child_sa_job.h b/src/charon/processing/jobs/rekey_child_sa_job.h
index df86070bc..38fd04f10 100644
--- a/src/charon/processing/jobs/rekey_child_sa_job.h
+++ b/src/charon/processing/jobs/rekey_child_sa_job.h
@@ -1,10 +1,3 @@
-/**
- * @file rekey_child_sa_job.h
- *
- * @brief Interface of rekey_child_sa_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,13 @@
* 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.
+ *
+ * $Id: rekey_child_sa_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup rekey_child_sa_job rekey_child_sa_job
+ * @{ @ingroup jobs
*/
#ifndef REKEY_CHILD_SA_JOB_H_
@@ -31,14 +31,9 @@ typedef struct rekey_child_sa_job_t rekey_child_sa_job_t;
#include <config/proposal.h>
/**
- * @brief Class representing an REKEY_CHILD_SA Job.
+ * Class representing an REKEY_CHILD_SA Job.
*
* This job initiates the rekeying of a CHILD SA.
- *
- * @b Constructors:
- * - rekey_child_sa_job_create()
- *
- * @ingroup jobs
*/
struct rekey_child_sa_job_t {
/**
@@ -48,7 +43,7 @@ struct rekey_child_sa_job_t {
};
/**
- * @brief Creates a job of type REKEY_CHILD_SA.
+ * Creates a job of type REKEY_CHILD_SA.
*
* The CHILD_SA is identified by its protocol (AH/ESP) and its
* inbound SPI.
@@ -57,9 +52,8 @@ struct rekey_child_sa_job_t {
* @param protocol protocol of the CHILD_SA
* @param spi security parameter index of the CHILD_SA
* @return rekey_child_sa_job_t object
- *
- * @ingroup jobs
*/
-rekey_child_sa_job_t *rekey_child_sa_job_create(u_int32_t reqid, protocol_id_t protocol, u_int32_t spi);
-
-#endif /* REKEY_CHILD_SA_JOB_H_ */
+rekey_child_sa_job_t *rekey_child_sa_job_create(u_int32_t reqid,
+ protocol_id_t protocol,
+ u_int32_t spi);
+#endif /* REKEY_CHILD_SA_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/rekey_ike_sa_job.c b/src/charon/processing/jobs/rekey_ike_sa_job.c
index 020c3cce8..38aa41c27 100644
--- a/src/charon/processing/jobs/rekey_ike_sa_job.c
+++ b/src/charon/processing/jobs/rekey_ike_sa_job.c
@@ -1,10 +1,3 @@
-/**
- * @file rekey_ike_sa_job.c
- *
- * @brief Implementation of rekey_ike_sa_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,13 +11,14 @@
* 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.
+ *
+ * $Id: rekey_ike_sa_job.c 3793 2008-04-11 08:14:48Z martin $
*/
-
+
#include "rekey_ike_sa_job.h"
#include <daemon.h>
-
typedef struct private_rekey_ike_sa_job_t private_rekey_ike_sa_job_t;
/**
@@ -74,7 +68,7 @@ static void execute(private_rekey_ike_sa_job_t *this)
{
if (this->reauth)
{
- status = ike_sa->reestablish(ike_sa);
+ status = ike_sa->reauth(ike_sa);
}
else
{
diff --git a/src/charon/processing/jobs/rekey_ike_sa_job.h b/src/charon/processing/jobs/rekey_ike_sa_job.h
index 4031b3813..c8d9abee3 100644
--- a/src/charon/processing/jobs/rekey_ike_sa_job.h
+++ b/src/charon/processing/jobs/rekey_ike_sa_job.h
@@ -1,10 +1,3 @@
-/**
- * @file rekey_ike_sa_job.h
- *
- * @brief Interface of rekey_ike_sa_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,6 +11,13 @@
* 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.
+ *
+ * $Id: rekey_ike_sa_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup rekey_ike_sa_job rekey_ike_sa_job
+ * @{ @ingroup jobs
*/
#ifndef REKEY_IKE_SA_JOB_H_
@@ -30,14 +30,9 @@ typedef struct rekey_ike_sa_job_t rekey_ike_sa_job_t;
#include <processing/jobs/job.h>
/**
- * @brief Class representing an REKEY_IKE_SA Job.
+ * Class representing an REKEY_IKE_SA Job.
*
* This job initiates the rekeying of an IKE_SA.
- *
- * @b Constructors:
- * - rekey_ike_sa_job_create()
- *
- * @ingroup jobs
*/
struct rekey_ike_sa_job_t {
/**
@@ -47,14 +42,12 @@ struct rekey_ike_sa_job_t {
};
/**
- * @brief Creates a job of type REKEY_IKE_SA.
+ * Creates a job of type REKEY_IKE_SA.
*
* @param ike_sa_id ID of the IKE_SA to rekey
* @param reauth TRUE to reauthenticate peer, FALSE for rekeying only
* @return rekey_ike_sa_job_t object
- *
- * @ingroup jobs
*/
rekey_ike_sa_job_t *rekey_ike_sa_job_create(ike_sa_id_t *ike_sa_id, bool reauth);
-#endif /* REKEY_IKE_SA_JOB_H_ */
+#endif /* REKEY_IKE_SA_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/retransmit_job.c b/src/charon/processing/jobs/retransmit_job.c
index 8c15aa651..89858786e 100644
--- a/src/charon/processing/jobs/retransmit_job.c
+++ b/src/charon/processing/jobs/retransmit_job.c
@@ -1,10 +1,3 @@
-/**
- * @file retransmit_job.c
- *
- * @brief Implementation of retransmit_job_t.
- *
- */
-
/*
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,8 @@
* 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.
+ *
+ * $Id: retransmit_job.c 3589 2008-03-13 14:14:44Z martin $
*/
#include "retransmit_job.h"
diff --git a/src/charon/processing/jobs/retransmit_job.h b/src/charon/processing/jobs/retransmit_job.h
index 93bb548e7..60932b304 100644
--- a/src/charon/processing/jobs/retransmit_job.h
+++ b/src/charon/processing/jobs/retransmit_job.h
@@ -1,10 +1,3 @@
-/**
- * @file retransmit_job.h
- *
- * @brief Interface of retransmit_job_t.
- *
- */
-
/*
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,13 @@
* 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.
+ *
+ * $Id: retransmit_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup retransmit_job retransmit_job
+ * @{ @ingroup jobs
*/
#ifndef RETRANSMIT_JOB_H_
@@ -31,16 +31,11 @@ typedef struct retransmit_job_t retransmit_job_t;
#include <sa/ike_sa_id.h>
/**
- * @brief Class representing an retransmit Job.
+ * Class representing an retransmit Job.
*
* This job is scheduled every time a request is sent over the
* wire. If the response to the request is not received at schedule
* time, the retransmission will be initiated.
- *
- * @b Constructors:
- * - retransmit_job_create()
- *
- * @ingroup jobs
*/
struct retransmit_job_t {
/**
@@ -50,15 +45,13 @@ struct retransmit_job_t {
};
/**
- * @brief Creates a job of type retransmit.
+ * Creates a job of type retransmit.
*
* @param message_id message_id of the request to resend
* @param ike_sa_id identification of the ike_sa as ike_sa_id_t
* @return retransmit_job_t object
- *
- * @ingroup jobs
*/
retransmit_job_t *retransmit_job_create(u_int32_t message_id,
ike_sa_id_t *ike_sa_id);
-#endif /* RETRANSMIT_JOB_H_ */
+#endif /* RETRANSMIT_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/roam_job.c b/src/charon/processing/jobs/roam_job.c
index 842f57405..0b323ae8b 100644
--- a/src/charon/processing/jobs/roam_job.c
+++ b/src/charon/processing/jobs/roam_job.c
@@ -1,10 +1,3 @@
-/**
- * @file roam_job.c
- *
- * @brief Implementation of roam_job_t.
- *
- */
-
/*
* Copyright (C) 2007 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -18,9 +11,10 @@
* 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.
+ *
+ * $Id: roam_job.c 3804 2008-04-14 11:37:46Z martin $
*/
-
#include <stdlib.h>
#include "roam_job.h"
@@ -62,18 +56,18 @@ static void execute(private_roam_job_t *this)
ike_sa_t *ike_sa;
linked_list_t *list;
ike_sa_id_t *id;
- iterator_t *iterator;
+ enumerator_t *enumerator;
- /* iterating over all IKE_SAs gives us no way to checkin_and_destroy
+ /* enumerator over all IKE_SAs gives us no way to checkin_and_destroy
* after a DESTROY_ME, so we check out each available IKE_SA by hand. */
list = linked_list_create();
- iterator = charon->ike_sa_manager->create_iterator(charon->ike_sa_manager);
- while (iterator->iterate(iterator, (void**)&ike_sa))
+ enumerator = charon->ike_sa_manager->create_enumerator(charon->ike_sa_manager);
+ while (enumerator->enumerate(enumerator, &ike_sa))
{
id = ike_sa->get_id(ike_sa);
list->insert_last(list, id->clone(id));
}
- iterator->destroy(iterator);
+ enumerator->destroy(enumerator);
while (list->remove_last(list, (void**)&id) == SUCCESS)
{
diff --git a/src/charon/processing/jobs/roam_job.h b/src/charon/processing/jobs/roam_job.h
index 293b09f08..763416b4a 100644
--- a/src/charon/processing/jobs/roam_job.h
+++ b/src/charon/processing/jobs/roam_job.h
@@ -1,9 +1,3 @@
-/**
- * @file roam_job.h
- *
- * @brief Interface of roam_job_t.
- */
-
/*
* Copyright (C) 2007 Martin Willi
* Hochschule fuer Technik Rapperswil
@@ -17,6 +11,13 @@
* 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.
+ *
+ * $Id: roam_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup roam_job roam_job
+ * @{ @ingroup jobs
*/
#ifndef ROAM_JOB_H_
@@ -29,15 +30,10 @@ typedef struct roam_job_t roam_job_t;
#include <processing/jobs/job.h>
/**
- * @brief A job to inform IKE_SAs about changed local address setup.
+ * A job to inform IKE_SAs about changed local address setup.
*
* If a local address appears or disappears, the kernel fires this job to
* update all IKE_SAs.
- *
- * @b Constructors:
- * - roam_job_create()
- *
- * @ingroup jobs
*/
struct roam_job_t {
@@ -48,14 +44,11 @@ struct roam_job_t {
};
/**
- * @brief Creates a job to inform IKE_SAs about an updated address list.
+ * Creates a job to inform IKE_SAs about an updated address list.
*
* @param address TRUE if address list changed, FALSE if routing changed
* @return initiate_ike_sa_job_t object
- *
- * @ingroup jobs
*/
roam_job_t *roam_job_create(bool address);
-#endif /*ROAM_JOB_H_*/
-
+#endif /*ROAM_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/send_dpd_job.c b/src/charon/processing/jobs/send_dpd_job.c
index d9c457ab6..a7d0cf3f3 100644
--- a/src/charon/processing/jobs/send_dpd_job.c
+++ b/src/charon/processing/jobs/send_dpd_job.c
@@ -1,10 +1,3 @@
-/**
- * @file send_dpd_job.c
- *
- * @brief Implementation of send_dpd_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
* Hochschule fuer Technik Rapperswil
@@ -18,9 +11,10 @@
* 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.
+ *
+ * $Id: send_dpd_job.c 3589 2008-03-13 14:14:44Z martin $
*/
-
#include <stdlib.h>
#include "send_dpd_job.h"
diff --git a/src/charon/processing/jobs/send_dpd_job.h b/src/charon/processing/jobs/send_dpd_job.h
index 0e4059131..032823edd 100644
--- a/src/charon/processing/jobs/send_dpd_job.h
+++ b/src/charon/processing/jobs/send_dpd_job.h
@@ -1,9 +1,3 @@
-/**
- * @file send_dpd_job.h
- *
- * @brief Interface of send_dpd_job_t.
- */
-
/*
* Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
* Hochschule fuer Technik Rapperswil
@@ -17,6 +11,13 @@
* 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.
+ *
+ * $Id: send_dpd_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup send_dpd_job send_dpd_job
+ * @{ @ingroup jobs
*/
#ifndef SEND_DPD_JOB_H_
@@ -29,16 +30,11 @@ typedef struct send_dpd_job_t send_dpd_job_t;
#include <sa/ike_sa_id.h>
/**
- * @brief Class representing a SEND_DPD Job.
+ * Class representing a SEND_DPD Job.
*
* Job to periodically send a Dead Peer Detection (DPD) request,
* ie. an IKE request with no payloads other than the encrypted payload
* required by the syntax.
- *
- * @b Constructors:
- * - send_dpd_job_create()
- *
- * @ingroup jobs
*/
struct send_dpd_job_t {
/**
@@ -48,13 +44,11 @@ struct send_dpd_job_t {
};
/**
- * @brief Creates a job of type SEND_DPD.
+ * Creates a job of type SEND_DPD.
*
* @param ike_sa_id identification of the ike_sa as ike_sa_id_t object (gets cloned)
* @return initiate_ike_sa_job_t object
- *
- * @ingroup jobs
*/
send_dpd_job_t *send_dpd_job_create(ike_sa_id_t *ike_sa_id);
-#endif /*SEND_DPD_JOB_H_*/
+#endif /*SEND_DPD_JOB_H_ @} */
diff --git a/src/charon/processing/jobs/send_keepalive_job.c b/src/charon/processing/jobs/send_keepalive_job.c
index 34198deb0..82f6a5f55 100644
--- a/src/charon/processing/jobs/send_keepalive_job.c
+++ b/src/charon/processing/jobs/send_keepalive_job.c
@@ -1,10 +1,3 @@
-/**
- * @file send_keepalive_job.c
- *
- * @brief Implementation of send_keepalive_job_t.
- *
- */
-
/*
* Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
* Hochschule fuer Technik Rapperswil
@@ -18,9 +11,10 @@
* 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.
+ *
+ * $Id: send_keepalive_job.c 3589 2008-03-13 14:14:44Z martin $
*/
-
#include <stdlib.h>
#include "send_keepalive_job.h"
diff --git a/src/charon/processing/jobs/send_keepalive_job.h b/src/charon/processing/jobs/send_keepalive_job.h
index e8d214aed..44bab09b4 100644
--- a/src/charon/processing/jobs/send_keepalive_job.h
+++ b/src/charon/processing/jobs/send_keepalive_job.h
@@ -1,9 +1,3 @@
-/**
- * @file send_keepalive_job.h
- *
- * @brief Interface of send_keepalive_job_t.
- */
-
/*
* Copyright (C) 2006 Tobias Brunner, Daniel Roethlisberger
* Hochschule fuer Technik Rapperswil
@@ -17,6 +11,13 @@
* 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.
+ *
+ * $Id: send_keepalive_job.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup send_keepalive_job send_keepalive_job
+ * @{ @ingroup jobs
*/
#ifndef SEND_KEEPALIVE_JOB_H_
@@ -29,15 +30,10 @@ typedef struct send_keepalive_job_t send_keepalive_job_t;
#include <sa/ike_sa_id.h>
/**
- * @brief Class representing a SEND_KEEPALIVE Job.
+ * Class representing a SEND_KEEPALIVE Job.
*
* This job will send a NAT keepalive packet if the IKE SA is still alive,
* and reinsert itself into the event queue.
- *
- * @b Constructors:
- * - send_keepalive_job_create()
- *
- * @ingroup jobs
*/
struct send_keepalive_job_t {
/**
@@ -47,13 +43,11 @@ struct send_keepalive_job_t {
};
/**
- * @brief Creates a job of type SEND_KEEPALIVE.
+ * Creates a job of type SEND_KEEPALIVE.
*
* @param ike_sa_id identification of the ike_sa as ike_sa_id_t object (gets cloned)
* @return initiate_ike_sa_job_t object
- *
- * @ingroup jobs
*/
send_keepalive_job_t *send_keepalive_job_create(ike_sa_id_t *ike_sa_id);
-#endif /*SEND_KEEPALIVE_JOB_H_*/
+#endif /*SEND_KEEPALIVE_JOB_H_ @} */
diff --git a/src/charon/processing/processor.c b/src/charon/processing/processor.c
index b3815eeb1..010f6624f 100644
--- a/src/charon/processing/processor.c
+++ b/src/charon/processing/processor.c
@@ -1,10 +1,3 @@
-/**
- * @file processor.c
- *
- * @brief Implementation of processor_t.
- *
- */
-
/*
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,8 @@
* 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.
+ *
+ * $Id: processor.c 3742 2008-04-03 09:19:12Z tobias $
*/
#include <stdlib.h>
@@ -35,7 +30,7 @@
typedef struct private_processor_t private_processor_t;
/**
- * @brief Private data of processor_t class.
+ * Private data of processor_t class.
*/
struct private_processor_t {
/**
@@ -71,7 +66,12 @@ struct private_processor_t {
/**
* Condvar to wait for new jobs
*/
- pthread_cond_t condvar;
+ pthread_cond_t jobadded;
+
+ /**
+ * Condvar to wait for terminated threads
+ */
+ pthread_cond_t threadterminated;
};
static void process_jobs(private_processor_t *this);
@@ -85,7 +85,10 @@ static void restart(private_processor_t *this)
if (pthread_create(&thread, NULL, (void*)process_jobs, this) != 0)
{
+ pthread_mutex_lock(&this->mutex);
this->total_threads--;
+ pthread_cond_broadcast(&this->threadterminated);
+ pthread_mutex_unlock(&this->mutex);
}
}
@@ -108,7 +111,7 @@ static void process_jobs(private_processor_t *this)
if (this->list->get_count(this->list) == 0)
{
this->idle_threads++;
- pthread_cond_wait(&this->condvar, &this->mutex);
+ pthread_cond_wait(&this->jobadded, &this->mutex);
this->idle_threads--;
continue;
}
@@ -121,7 +124,7 @@ static void process_jobs(private_processor_t *this)
pthread_mutex_lock(&this->mutex);
}
this->total_threads--;
- pthread_cond_broadcast(&this->condvar);
+ pthread_cond_signal(&this->threadterminated);
pthread_mutex_unlock(&this->mutex);
}
@@ -130,7 +133,11 @@ static void process_jobs(private_processor_t *this)
*/
static u_int get_total_threads(private_processor_t *this)
{
- return this->total_threads;
+ u_int count;
+ pthread_mutex_lock(&this->mutex);
+ count = this->total_threads;
+ pthread_mutex_unlock(&this->mutex);
+ return count;
}
/**
@@ -138,7 +145,11 @@ static u_int get_total_threads(private_processor_t *this)
*/
static u_int get_idle_threads(private_processor_t *this)
{
- return this->idle_threads;
+ u_int count;
+ pthread_mutex_lock(&this->mutex);
+ count = this->idle_threads;
+ pthread_mutex_unlock(&this->mutex);
+ return count;
}
/**
@@ -160,8 +171,8 @@ static void queue_job(private_processor_t *this, job_t *job)
{
pthread_mutex_lock(&this->mutex);
this->list->insert_last(this->list, job);
+ pthread_cond_signal(&this->jobadded);
pthread_mutex_unlock(&this->mutex);
- pthread_cond_signal(&this->condvar);
}
/**
@@ -189,6 +200,7 @@ static void set_threads(private_processor_t *this, u_int count)
{ /* decrease thread count */
this->desired_threads = count;
}
+ pthread_cond_broadcast(&this->jobadded);
pthread_mutex_unlock(&this->mutex);
}
@@ -198,11 +210,13 @@ static void set_threads(private_processor_t *this, u_int count)
static void destroy(private_processor_t *this)
{
set_threads(this, 0);
+ pthread_mutex_lock(&this->mutex);
while (this->total_threads > 0)
{
- pthread_cond_broadcast(&this->condvar);
- pthread_cond_wait(&this->condvar, &this->mutex);
+ pthread_cond_broadcast(&this->jobadded);
+ pthread_cond_wait(&this->threadterminated, &this->mutex);
}
+ pthread_mutex_unlock(&this->mutex);
this->list->destroy_offset(this->list, offsetof(job_t, destroy));
free(this);
}
@@ -223,7 +237,8 @@ processor_t *processor_create(size_t pool_size)
this->list = linked_list_create();
pthread_mutex_init(&this->mutex, NULL);
- pthread_cond_init(&this->condvar, NULL);
+ pthread_cond_init(&this->jobadded, NULL);
+ pthread_cond_init(&this->threadterminated, NULL);
this->total_threads = 0;
this->desired_threads = 0;
this->idle_threads = 0;
diff --git a/src/charon/processing/processor.h b/src/charon/processing/processor.h
index f12c7f10e..530fbc24b 100644
--- a/src/charon/processing/processor.h
+++ b/src/charon/processing/processor.h
@@ -1,10 +1,3 @@
-/**
- * @file processor.h
- *
- * @brief Interface of processor_t.
- *
- */
-
/*
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,13 @@
* 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.
+ *
+ * $Id: processor.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup processor processor
+ * @{ @ingroup processing
*/
#ifndef PROCESSOR_H_
@@ -32,80 +32,65 @@ typedef struct processor_t processor_t;
#include <processing/jobs/job.h>
/**
- * @brief The processor uses threads to process queued jobs.
- *
- * @b Constructors:
- * - processor_create()
- *
- * @ingroup processing
+ * The processor uses threads to process queued jobs.
*/
struct processor_t {
/**
- * @brief Get the total number of threads used by the processor.
- *
- * @param this calling object
+ * Get the total number of threads used by the processor.
+ *
* @return size of thread pool
*/
u_int (*get_total_threads) (processor_t *this);
/**
- * @brief Get the number of threads currently waiting.
- *
- * @param this calling object
+ * Get the number of threads currently waiting.
+ *
* @return number of idle threads
*/
u_int (*get_idle_threads) (processor_t *this);
/**
- * @brief Get the number of queued jobs.
+ * Get the number of queued jobs.
*
- * @param this calling object
* @returns number of items in queue
*/
u_int (*get_job_load) (processor_t *this);
/**
- * @brief Adds a job to the queue.
+ * Adds a job to the queue.
*
* This function is non blocking and adds a job_t to the queue.
*
- * @param this calling object
* @param job job to add to the queue
*/
void (*queue_job) (processor_t *this, job_t *job);
/**
- * @brief Set the number of threads to use in the processor.
+ * Set the number of threads to use in the processor.
*
* If the number of threads is smaller than number of currently running
* threads, thread count is decreased. Use 0 to disable the processor.
* This call blocks if it decreases thread count until threads have
* terminated, so make sure there are not too many blocking jobs.
*
- * @param this calling object
* @param count number of threads to allocate
*/
void (*set_threads)(processor_t *this, u_int count);
/**
- * @brief Destroy a processor object.
- *
- * @param processor calling object
+ * Destroy a processor object.
*/
void (*destroy) (processor_t *processor);
};
/**
- * @brief Create the thread pool without any threads.
+ * Create the thread pool without any threads.
*
* Use the set_threads method to start processing jobs.
*
* @return processor_t object
- *
- * @ingroup processing
*/
processor_t *processor_create();
-#endif /*PROCESSOR_H_*/
-
+#endif /*PROCESSOR_H_ @} */
diff --git a/src/charon/processing/scheduler.c b/src/charon/processing/scheduler.c
index ededb479a..42aa2579e 100644
--- a/src/charon/processing/scheduler.c
+++ b/src/charon/processing/scheduler.c
@@ -1,10 +1,3 @@
-/**
- * @file scheduler.c
- *
- * @brief Implementation of scheduler_t.
- *
- */
-
/*
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,8 @@
* 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.
+ *
+ * $Id: scheduler.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stdlib.h>
diff --git a/src/charon/processing/scheduler.h b/src/charon/processing/scheduler.h
index 7bde6e638..edc17a02b 100644
--- a/src/charon/processing/scheduler.h
+++ b/src/charon/processing/scheduler.h
@@ -1,10 +1,3 @@
-/**
- * @file scheduler.h
- *
- * @brief Interface of scheduler_t.
- *
- */
-
/*
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
@@ -19,6 +12,13 @@
* 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.
+ *
+ * $Id: scheduler.h 3589 2008-03-13 14:14:44Z martin $
+ */
+
+/**
+ * @defgroup scheduler scheduler
+ * @{ @ingroup processing
*/
#ifndef SCHEDULER_H_
@@ -30,52 +30,40 @@ typedef struct scheduler_t scheduler_t;
#include <processing/jobs/job.h>
/**
- * @brief The scheduler queues and executes timed events.
+ * The scheduler queues and executes timed events.
*
* The scheduler stores timed events and passes them to the processor.
- *
- * @b Constructors:
- * - scheduler_create()
- *
- * @ingroup processing
*/
struct scheduler_t {
/**
- * @brief Adds a event to the queue, using a relative time offset.
+ * Adds a event to the queue, using a relative time offset.
*
* Schedules a job for execution using a relative time offset.
*
- * @param this calling object
* @param job job to schedule
* @param time relative to to schedule job (in ms)
*/
void (*schedule_job) (scheduler_t *this, job_t *job, u_int32_t time);
/**
- * @brief Returns number of jobs scheduled.
+ * Returns number of jobs scheduled.
*
- * @param this calling object
* @return number of scheduled jobs
*/
u_int (*get_job_load) (scheduler_t *this);
/**
- * @brief Destroys a scheduler object.
- *
- * @param this calling object
+ * Destroys a scheduler object.
*/
void (*destroy) (scheduler_t *this);
};
/**
- * @brief Create a scheduler.
+ * Create a scheduler.
*
* @return scheduler_t object
- *
- * @ingroup processing
*/
scheduler_t *scheduler_create(void);
-#endif /*SCHEDULER_H_*/
-
+#endif /*SCHEDULER_H_ @} */