aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/queues
diff options
context:
space:
mode:
Diffstat (limited to 'Source/charon/queues')
-rw-r--r--Source/charon/queues/event_queue.h5
-rw-r--r--Source/charon/queues/job_queue.h18
-rw-r--r--Source/charon/queues/jobs/delete_ike_sa_job.c26
-rw-r--r--Source/charon/queues/jobs/delete_ike_sa_job.h24
-rw-r--r--Source/charon/queues/jobs/incoming_packet_job.c46
-rw-r--r--Source/charon/queues/jobs/incoming_packet_job.h25
-rw-r--r--Source/charon/queues/jobs/initiate_ike_sa_job.c31
-rw-r--r--Source/charon/queues/jobs/initiate_ike_sa_job.h16
-rw-r--r--Source/charon/queues/jobs/job.c2
-rw-r--r--Source/charon/queues/jobs/job.h25
-rw-r--r--Source/charon/queues/send_queue.h11
11 files changed, 96 insertions, 133 deletions
diff --git a/Source/charon/queues/event_queue.h b/Source/charon/queues/event_queue.h
index ed0a85869..41700cf17 100644
--- a/Source/charon/queues/event_queue.h
+++ b/Source/charon/queues/event_queue.h
@@ -35,6 +35,8 @@ typedef struct event_queue_t event_queue_t;
*
* Although the event-queue is based on a linked_list_t
* all access functions are thread-save implemented.
+ *
+ * @ingroup queues
*/
struct event_queue_t {
@@ -100,6 +102,9 @@ struct event_queue_t {
* @brief Creates an empty event_queue
*
* @returns event_queue
+ *
+ * @ingroup queues
*/
event_queue_t *event_queue_create();
+
#endif /*EVENT_QUEUE_H_*/
diff --git a/Source/charon/queues/job_queue.h b/Source/charon/queues/job_queue.h
index b0a3066db..48b6f07c1 100644
--- a/Source/charon/queues/job_queue.h
+++ b/Source/charon/queues/job_queue.h
@@ -1,7 +1,7 @@
/**
* @file job_queue.h
*
- * @brief Interface of job_queue_t-
+ * @brief Interface of job_queue_t.
*
*/
@@ -32,7 +32,9 @@ typedef struct job_queue_t job_queue_t;
* @brief Job-Queue
*
* Although the job-queue is based on a linked_list_t
- * all access functions are thread-save implemented
+ * all access functions are thread-save implemented.
+ *
+ * @ingroup queues
*/
struct job_queue_t {
@@ -52,7 +54,7 @@ struct job_queue_t {
*
* @param job_queue_t calling object
* @param[out] job pointer to a job pointer where to job is returned to
- * @return job
+ * @return next job
*/
job_t *(*get) (job_queue_t *job_queue);
@@ -63,8 +65,8 @@ struct job_queue_t {
* The specific job object has to get destroyed by the thread which
* removes the job.
*
- * @param job_queue_t calling object
- * @param[in] job job to add to the queue (job is not copied)
+ * @param job_queue_t calling object
+ * @param job job to add to the queue (job is not copied)
*/
void (*add) (job_queue_t *job_queue, job_t *job);
@@ -75,15 +77,17 @@ struct job_queue_t {
* that no thread is going to add or get a job from the job_queue
* after calling this function.
*
- * @param job_queue_t calling object
+ * @param job_queue_t calling object
*/
void (*destroy) (job_queue_t *job_queue);
};
/**
- * @brief Creates an empty job_queue
+ * @brief Creates an empty job_queue.
*
* @return job_queue_t empty job_queue
+ *
+ * @ingroup queues
*/
job_queue_t *job_queue_create();
diff --git a/Source/charon/queues/jobs/delete_ike_sa_job.c b/Source/charon/queues/jobs/delete_ike_sa_job.c
index 5041d1f16..ee0118674 100644
--- a/Source/charon/queues/jobs/delete_ike_sa_job.c
+++ b/Source/charon/queues/jobs/delete_ike_sa_job.c
@@ -1,7 +1,7 @@
/**
* @file delete_ike_sa_job.h
*
- * @brief Job of type DELETE_IKE_SA
+ * @brief Implementation of delete_ike_sa_job_t.
*
*/
@@ -29,7 +29,6 @@ typedef struct private_delete_ike_sa_job_t private_delete_ike_sa_job_t;
/**
* Private data of an delete_ike_sa_job_t Object
- *
*/
struct private_delete_ike_sa_job_t {
/**
@@ -43,10 +42,8 @@ struct private_delete_ike_sa_job_t {
ike_sa_id_t *ike_sa_id;
};
-
/**
- * Implements delete_ike_sa_job_t's get_type function.
- * See #delete_ike_sa_job_t.get_type for description.
+ * Implements job_t.get_type.
*/
static job_type_t get_type(private_delete_ike_sa_job_t *this)
{
@@ -54,24 +51,21 @@ static job_type_t get_type(private_delete_ike_sa_job_t *this)
}
/**
- * Implements delete_ike_sa_job_t's get_ike_sa_id function.
- * See #delete_ike_sa_job_t.get_ike_sa_id for description.
+ * Implements elete_ike_sa_job_t.get_ike_sa_id
*/
-static ike_sa_id_t * get_ike_sa_id(private_delete_ike_sa_job_t *this)
+static ike_sa_id_t *get_ike_sa_id(private_delete_ike_sa_job_t *this)
{
return this->ike_sa_id;
}
/**
- * Implements job_t's and delete_ike_sa_job_t's destroy function.
- * See #job_t.destroy or #delete_ike_sa_job_t.destroy for description.
+ * Implements job_t.destroy.
*/
-static status_t destroy(job_t *job)
+static void destroy(job_t *job)
{
private_delete_ike_sa_job_t *this = (private_delete_ike_sa_job_t *) job;
this->ike_sa_id->destroy(this->ike_sa_id);
allocator_free(this);
- return SUCCESS;
}
/*
@@ -80,20 +74,16 @@ static status_t destroy(job_t *job)
delete_ike_sa_job_t *delete_ike_sa_job_create(ike_sa_id_t *ike_sa_id)
{
private_delete_ike_sa_job_t *this = allocator_alloc_thing(private_delete_ike_sa_job_t);
- if (this == NULL)
- {
- return NULL;
- }
/* interface functions */
this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
/* same as destroy */
- this->public.job_interface.destroy_all = (status_t (*) (job_t *)) destroy;
+ this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy;
this->public.job_interface.destroy = destroy;
/* public functions */
this->public.get_ike_sa_id = (ike_sa_id_t * (*)(delete_ike_sa_job_t *)) get_ike_sa_id;
- this->public.destroy = (status_t (*)(delete_ike_sa_job_t *)) destroy;
+ this->public.destroy = (void (*)(delete_ike_sa_job_t *)) destroy;
/* private variables */
this->ike_sa_id = ike_sa_id->clone(ike_sa_id);
diff --git a/Source/charon/queues/jobs/delete_ike_sa_job.h b/Source/charon/queues/jobs/delete_ike_sa_job.h
index b5674fb59..e4e254370 100644
--- a/Source/charon/queues/jobs/delete_ike_sa_job.h
+++ b/Source/charon/queues/jobs/delete_ike_sa_job.h
@@ -1,7 +1,7 @@
/**
* @file delete_ike_sa_job.h
*
- * @brief Job of type DELETE_IKE_SA
+ * @brief Interface of delete_ike_sa_job_t.
*
*/
@@ -31,8 +31,9 @@
typedef struct delete_ike_sa_job_t delete_ike_sa_job_t;
/**
- * Object representing an DELETE_IKE_SA Job
+ * @brief Class representing an DELETE_IKE_SA Job.
*
+ * @ingroup jobs
*/
struct delete_ike_sa_job_t {
/**
@@ -41,7 +42,7 @@ struct delete_ike_sa_job_t {
job_t job_interface;
/**
- * @brief Returns the currently set ike_sa_id
+ * @brief Returns the currently set ike_sa_id.
*
* @warning Returned object is not copied.
*
@@ -51,24 +52,21 @@ struct delete_ike_sa_job_t {
ike_sa_id_t * (*get_ike_sa_id) (delete_ike_sa_job_t *this);
/**
- * @brief Destroys an delete_ike_sa_job_t object (including assigned data)
+ * @brief Destroys an delete_ike_sa_job_t object (including assigned data).
*
* @param this delete_ike_sa_job_t object to destroy
- * @return
- * SUCCESS in any case
*/
- status_t (*destroy) (delete_ike_sa_job_t *this);
+ void (*destroy) (delete_ike_sa_job_t *this);
};
/**
- * Creates a job of type DELETE_IKE_SA
+ * @brief Creates a job of type DELETE_IKE_SA.
*
- * @param ike_sa_id id of the IKE_SA to delete
- * @return
- * - delete_ike_sa_job_t if successfully
- * - NULL if out of ressources
+ * @param ike_sa_id id of the IKE_SA to delete
+ * @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);
-
#endif /*DELETE_IKE_SA_JOB_H_*/
diff --git a/Source/charon/queues/jobs/incoming_packet_job.c b/Source/charon/queues/jobs/incoming_packet_job.c
index 9d66bee53..ee8dac698 100644
--- a/Source/charon/queues/jobs/incoming_packet_job.c
+++ b/Source/charon/queues/jobs/incoming_packet_job.c
@@ -1,7 +1,7 @@
/**
* @file incoming_packet_job.h
*
- * @brief Job of type INCOMING_PACKET
+ * @brief Implementation of incoming_packet_job_t.
*
*/
@@ -30,7 +30,6 @@ typedef struct private_incoming_packet_job_t private_incoming_packet_job_t;
/**
* Private data of an incoming_packet_job_t Object
- *
*/
struct private_incoming_packet_job_t {
/**
@@ -44,10 +43,8 @@ struct private_incoming_packet_job_t {
packet_t *packet;
};
-
/**
- * Implements incoming_packet_job_t's get_type function.
- * See #incoming_packet_job_t.get_type for description.
+ * Implements job_t.get_type.
*/
static job_type_t get_type(private_incoming_packet_job_t *this)
{
@@ -55,66 +52,49 @@ static job_type_t get_type(private_incoming_packet_job_t *this)
}
/**
- * Implements incoming_packet_job_t's get_configuration_name function.
- * See #incoming_packet_job_t.get_configuration_name for description.
+ * Implements incoming_packet_job_t.get_packet.
*/
-static status_t get_packet(private_incoming_packet_job_t *this,packet_t **packet)
+static packet_t *get_packet(private_incoming_packet_job_t *this)
{
- if (this->packet == NULL)
- {
- return FAILED;
- }
- *packet = this->packet;
- return SUCCESS;
+ return this->packet;
}
-
-
/**
- * Implements job_t's and destroy_all function.
- * See #job_t.destroy_all description.
+ * Implements job_t.destroy_all.
*/
-static status_t destroy_all(private_incoming_packet_job_t *this)
+static void destroy_all(private_incoming_packet_job_t *this)
{
if (this->packet != NULL)
{
this->packet->destroy(this->packet);
}
allocator_free(this);
- return SUCCESS;
}
/**
- * Implements job_t's and incoming_packet_job_t's destroy function.
- * See #job_t.destroy or #incoming_packet_job_t.destroy for description.
+ * Implements job_t.destroy.
*/
-static status_t destroy(job_t *job)
+static void destroy(job_t *job)
{
private_incoming_packet_job_t *this = (private_incoming_packet_job_t *) job;
allocator_free(this);
- return SUCCESS;
}
-
/*
* Described in header
*/
incoming_packet_job_t *incoming_packet_job_create(packet_t *packet)
{
private_incoming_packet_job_t *this = allocator_alloc_thing(private_incoming_packet_job_t);
- if ((this == NULL))
- {
- return NULL;
- }
-
+
/* interface functions */
this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
- this->public.job_interface.destroy_all = (status_t (*) (job_t *)) destroy_all;
+ this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy_all;
this->public.job_interface.destroy = destroy;
/* public functions */
- this->public.get_packet = (status_t (*)(incoming_packet_job_t *,packet_t **)) get_packet;
- this->public.destroy = (status_t (*)(incoming_packet_job_t *)) destroy;
+ this->public.get_packet = (packet_t * (*)(incoming_packet_job_t *)) get_packet;
+ this->public.destroy = (void (*)(incoming_packet_job_t *)) destroy;
/* private variables */
this->packet = packet;
diff --git a/Source/charon/queues/jobs/incoming_packet_job.h b/Source/charon/queues/jobs/incoming_packet_job.h
index 757ab12e3..d57809df0 100644
--- a/Source/charon/queues/jobs/incoming_packet_job.h
+++ b/Source/charon/queues/jobs/incoming_packet_job.h
@@ -1,7 +1,7 @@
/**
* @file incoming_packet_job.h
*
- * @brief Job of type INCOMING_PACKET
+ * @brief Interface of incoming_packet_job_t.
*
*/
@@ -31,8 +31,9 @@
typedef struct incoming_packet_job_t incoming_packet_job_t;
/**
- * Object representing an INCOMING_PACKET Job
+ * @brief Object representing an INCOMING_PACKET Job.
*
+ * @ingroup jobs
*/
struct incoming_packet_job_t {
/**
@@ -46,32 +47,26 @@ struct incoming_packet_job_t {
* @warning Returned packet is not cloned and has to get destroyed by the caller.
*
* @param this calling incoming_packet_job_t object
- * @param[out] packet assigned packet will be written into this location
- * @return
- * - SUCCESS
- * - FAILED if no packet is assigned
+ * @return assigned packet
*/
- status_t (*get_packet) (incoming_packet_job_t *this, packet_t **packet);
+ packet_t *(*get_packet) (incoming_packet_job_t *this);
/**
* @brief Destroys an incoming_packet_job_t object.
*
* @param this incoming_packet_job_t object to destroy
- * @return
- * SUCCESS in any case
*/
- status_t (*destroy) (incoming_packet_job_t *this);
+ void (*destroy) (incoming_packet_job_t *this);
};
/**
- * Creates a job of type INCOMING_PACKET
+ * @brief Creates a job of type INCOMING_PACKET
*
* @param[in] packet packet to assign with this job
- * @return
- * - incoming_packet_job_t if successfully
- * - NULL if out of ressources
+ * @return created incoming_packet_job_t object
+ *
+ * @ingroup jobs
*/
incoming_packet_job_t *incoming_packet_job_create(packet_t *packet);
-
#endif /*INCOMING_PACKET_JOB_H_*/
diff --git a/Source/charon/queues/jobs/initiate_ike_sa_job.c b/Source/charon/queues/jobs/initiate_ike_sa_job.c
index b58bd71c4..75abc77eb 100644
--- a/Source/charon/queues/jobs/initiate_ike_sa_job.c
+++ b/Source/charon/queues/jobs/initiate_ike_sa_job.c
@@ -1,7 +1,7 @@
/**
* @file initiate_ike_sa_job.c
*
- * @brief Job of type INITIATE_IKE_SA
+ * @brief Implementation of initiate_ike_sa_job_t.
*
*/
@@ -32,7 +32,6 @@ typedef struct private_initiate_ike_sa_job_t private_initiate_ike_sa_job_t;
/**
* Private data of an initiate_ike_sa_job_t Object
- *
*/
struct private_initiate_ike_sa_job_t {
/**
@@ -48,8 +47,7 @@ struct private_initiate_ike_sa_job_t {
/**
- * Implements initiate_ike_sa_job_t's get_type function.
- * See #initiate_ike_sa_job_t.get_type for description.
+ * Implements initiate_ike_sa_job_t.get_type.
*/
static job_type_t get_type(private_initiate_ike_sa_job_t *this)
{
@@ -57,55 +55,42 @@ static job_type_t get_type(private_initiate_ike_sa_job_t *this)
}
/**
- * Implements initiate_ike_sa_job_t's get_configuration_name function.
- * See #initiate_ike_sa_job_t.get_configuration_name for description.
+ * Implements initiate_ike_sa_job_t.get_configuration_name.
*/
-static char * get_configuration_name(private_initiate_ike_sa_job_t *this)
+static char *get_configuration_name(private_initiate_ike_sa_job_t *this)
{
return this->configuration_name;
}
/**
- * Implements job_t's and initiate_ike_sa_job_t's destroy function.
- * See #job_t.destroy or #initiate_ike_sa_job_t.destroy for description.
+ * Implements job_t.destroy.
*/
-static status_t destroy(job_t *job)
+static void destroy(job_t *job)
{
private_initiate_ike_sa_job_t *this = (private_initiate_ike_sa_job_t *) job;
allocator_free(this->configuration_name);
allocator_free(this);
- return SUCCESS;
}
-
/*
* Described in header
*/
initiate_ike_sa_job_t *initiate_ike_sa_job_create(char *configuration_name)
{
private_initiate_ike_sa_job_t *this = allocator_alloc_thing(private_initiate_ike_sa_job_t);
- if ((this == NULL) || (configuration_name == NULL))
- {
- return NULL;
- }
/* interface functions */
this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
/* same as destroy */
- this->public.job_interface.destroy_all = (status_t (*) (job_t *)) destroy;
+ this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy;
this->public.job_interface.destroy = destroy;
/* public functions */
this->public.get_configuration_name = (char * (*)(initiate_ike_sa_job_t *)) get_configuration_name;
- this->public.destroy = (status_t (*)(initiate_ike_sa_job_t *)) destroy;
+ this->public.destroy = (void (*)(initiate_ike_sa_job_t *)) destroy;
/* private variables */
this->configuration_name = allocator_alloc(strlen(configuration_name) + 1);
- if (this->configuration_name == NULL)
- {
- allocator_free(this);
- return NULL;
- }
strcpy(this->configuration_name,configuration_name);
return &(this->public);
diff --git a/Source/charon/queues/jobs/initiate_ike_sa_job.h b/Source/charon/queues/jobs/initiate_ike_sa_job.h
index a5bbc9300..a38218121 100644
--- a/Source/charon/queues/jobs/initiate_ike_sa_job.h
+++ b/Source/charon/queues/jobs/initiate_ike_sa_job.h
@@ -1,8 +1,7 @@
/**
* @file initiate_ike_sa_job.h
*
- * @brief Job of type INITIATE_IKE_SA
- *
+ * @brief Interface of initiate_ike_sa_job_t.
*/
/*
@@ -31,6 +30,7 @@ typedef struct initiate_ike_sa_job_t initiate_ike_sa_job_t;
/**
* Object representing an INITIATE_IKE_SA Job
*
+ * @ingroup jobs
*/
struct initiate_ike_sa_job_t {
/**
@@ -52,19 +52,17 @@ struct initiate_ike_sa_job_t {
* @brief Destroys an initiate_ike_sa_job_t object.
*
* @param this initiate_ike_sa_job_t object to destroy
- * @return
- * SUCCESS in any case
*/
- status_t (*destroy) (initiate_ike_sa_job_t *this);
+ void (*destroy) (initiate_ike_sa_job_t *this);
};
/**
- * Creates a job of type INITIATE_IKE_SA
+ * @brief Creates a job of type INITIATE_IKE_SA.
*
* @param configuration_name name of the configuration to initiate IKE_SA with
- * @return
- * - initiate_ike_sa_job_t if successfully
- * - NULL if out of ressources or no configuration_name given
+ * @return initiate_ike_sa_job_t object
+ *
+ * @ingroup jobs
*/
initiate_ike_sa_job_t *initiate_ike_sa_job_create(char *configuration_name);
diff --git a/Source/charon/queues/jobs/job.c b/Source/charon/queues/jobs/job.c
index 95b802e36..6cd7cbdd0 100644
--- a/Source/charon/queues/jobs/job.c
+++ b/Source/charon/queues/jobs/job.c
@@ -1,7 +1,7 @@
/**
* @file job.c
*
- * @brief Job-Interface representing a job e.g. in job_queue
+ * @brief Interface additions to job_t.
*
*/
diff --git a/Source/charon/queues/jobs/job.h b/Source/charon/queues/jobs/job.h
index 57c615f25..ee1675fcd 100644
--- a/Source/charon/queues/jobs/job.h
+++ b/Source/charon/queues/jobs/job.h
@@ -1,7 +1,7 @@
/**
* @file job.h
*
- * @brief Job-Interface representing a job e.g. in job_queue
+ * @brief Interface job_t.
*
*/
@@ -30,7 +30,9 @@
typedef enum job_type_t job_type_t;
/**
- * Type of Jobs in Job-Queue
+ * @brief Definition of the various job types.
+ *
+ * @ingroup jobs
*/
enum job_type_t {
/**
@@ -60,20 +62,25 @@ enum job_type_t {
/* more job types have to be inserted here */
};
+/**
+ * string mappings for job_type_t
+ */
extern mapping_t job_type_m[];
typedef struct job_t job_t;
/**
- * @brief Job-Interface as it is stored in the job queue
+ * @brief Job-Interface as it is stored in the job queue.
+ *
+ * A job consists of a job-type and one or more assigned values.
*
- * A job consists of a job-type and one or more assigned values
+ * @ingroup jobs
*/
-struct job_t{
+struct job_t {
/**
- * @brief get type of job
+ * @brief get type of job.
*
* @param this calling object
* @return type of this job
@@ -84,17 +91,15 @@ struct job_t{
* @brief Destroys a job_t object and all assigned data!
*
* @param job_t calling object
- * @returns SUCCESS if succeeded, FAILED otherwise
*/
- status_t (*destroy_all) (job_t *job);
+ void (*destroy_all) (job_t *job);
/**
* @brief Destroys a job_t object
*
* @param job_t calling object
- * @returns SUCCESS if succeeded, FAILED otherwise
*/
- status_t (*destroy) (job_t *job);
+ void (*destroy) (job_t *job);
};
diff --git a/Source/charon/queues/send_queue.h b/Source/charon/queues/send_queue.h
index f023f29af..646d7adc9 100644
--- a/Source/charon/queues/send_queue.h
+++ b/Source/charon/queues/send_queue.h
@@ -33,7 +33,9 @@ typedef struct send_queue_t send_queue_t;
* @brief Send-Queue
*
* Although the send-queue is based on a linked_list_t
- * all access functions are thread-save implemented
+ * all access functions are thread-save implemented.
+ *
+ * @ingroup queues
*/
struct send_queue_t {
@@ -54,7 +56,7 @@ struct send_queue_t {
* After using, the returned packet has to get destroyed by the caller.
*
* @param send_queue_t calling object
- * @param[out] packet pointer to a packet_t pointer where to packet is returned to
+ * @return next packet from the queue
*/
packet_t *(*get) (send_queue_t *send_queue);
@@ -77,8 +79,7 @@ struct send_queue_t {
* that no thread is going to add or get a packet from the send_queue
* after calling this function.
*
- * @param send_queue_t calling object
- * @returns SUCCESS if succeeded, FAILED otherwise
+ * @param send_queue_t calling object
*/
void (*destroy) (send_queue_t *send_queue);
};
@@ -87,6 +88,8 @@ struct send_queue_t {
* @brief Creates an empty send_queue_t.
*
* @return send_queue_t empty send_queue_t
+ *
+ * @ingroup queues
*/
send_queue_t *send_queue_create();