aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/queues
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-03-16 15:25:06 +0000
committerMartin Willi <martin@strongswan.org>2006-03-16 15:25:06 +0000
commit16b9a73cc4bd4c4fafc8618fdd4c05ab72195df1 (patch)
treeb7d3214d59942dbd75ad8b9b8f86468f82f7a496 /Source/charon/queues
parentb1953ccd05b5e6cf5a87c557208d5f8a1fcad231 (diff)
downloadstrongswan-16b9a73cc4bd4c4fafc8618fdd4c05ab72195df1.tar.bz2
strongswan-16b9a73cc4bd4c4fafc8618fdd4c05ab72195df1.tar.xz
- reworked configuration framework completly
- configuration is now split up in: connections, policies, credentials and daemon config - further alloc/free fixes needed!
Diffstat (limited to 'Source/charon/queues')
-rw-r--r--Source/charon/queues/jobs/initiate_ike_sa_job.c33
-rw-r--r--Source/charon/queues/jobs/initiate_ike_sa_job.h18
-rw-r--r--Source/charon/queues/jobs/retransmit_request_job.h6
3 files changed, 31 insertions, 26 deletions
diff --git a/Source/charon/queues/jobs/initiate_ike_sa_job.c b/Source/charon/queues/jobs/initiate_ike_sa_job.c
index 75abc77eb..8837cd8f4 100644
--- a/Source/charon/queues/jobs/initiate_ike_sa_job.c
+++ b/Source/charon/queues/jobs/initiate_ike_sa_job.c
@@ -40,9 +40,9 @@ struct private_initiate_ike_sa_job_t {
initiate_ike_sa_job_t public;
/**
- * Name of the assigned configuration
+ * associated connection object to initiate
*/
- char *configuration_name;
+ connection_t *connection;
};
@@ -57,41 +57,46 @@ static job_type_t get_type(private_initiate_ike_sa_job_t *this)
/**
* Implements initiate_ike_sa_job_t.get_configuration_name.
*/
-static char *get_configuration_name(private_initiate_ike_sa_job_t *this)
+static connection_t *get_connection(private_initiate_ike_sa_job_t *this)
{
- return this->configuration_name;
+ return this->connection;
}
/**
* Implements job_t.destroy.
*/
-static void destroy(job_t *job)
+static void destroy_all(private_initiate_ike_sa_job_t *this)
+{
+ this->connection->destroy(this->connection);
+ allocator_free(this);
+}
+
+/**
+ * Implements job_t.destroy.
+ */
+static void destroy(private_initiate_ike_sa_job_t *this)
{
- private_initiate_ike_sa_job_t *this = (private_initiate_ike_sa_job_t *) job;
- allocator_free(this->configuration_name);
allocator_free(this);
}
/*
* Described in header
*/
-initiate_ike_sa_job_t *initiate_ike_sa_job_create(char *configuration_name)
+initiate_ike_sa_job_t *initiate_ike_sa_job_create(connection_t *connection)
{
private_initiate_ike_sa_job_t *this = allocator_alloc_thing(private_initiate_ike_sa_job_t);
/* interface functions */
this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
- /* same as destroy */
- this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy;
- this->public.job_interface.destroy = destroy;
+ this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy_all;
+ this->public.job_interface.destroy = (void (*) (job_t *)) destroy;
/* public functions */
- this->public.get_configuration_name = (char * (*)(initiate_ike_sa_job_t *)) get_configuration_name;
+ this->public.get_connection = (connection_t* (*)(initiate_ike_sa_job_t *)) get_connection;
this->public.destroy = (void (*)(initiate_ike_sa_job_t *)) destroy;
/* private variables */
- this->configuration_name = allocator_alloc(strlen(configuration_name) + 1);
- strcpy(this->configuration_name,configuration_name);
+ this->connection = connection;
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 ec6e4c1b0..d15ddf2a9 100644
--- a/Source/charon/queues/jobs/initiate_ike_sa_job.h
+++ b/Source/charon/queues/jobs/initiate_ike_sa_job.h
@@ -24,6 +24,8 @@
#include <types.h>
#include <queues/jobs/job.h>
+#include <config/connection.h>
+
typedef struct initiate_ike_sa_job_t initiate_ike_sa_job_t;
@@ -31,7 +33,7 @@ typedef struct initiate_ike_sa_job_t initiate_ike_sa_job_t;
* @brief Class representing an INITIATE_IKE_SA Job.
*
* This job is created if an IKE_SA should be iniated. This
- * happens form a user request, or via the kernel interface.
+ * happens via a user request, or via the kernel interface.
*
* @b Constructors:
* - initiate_ike_sa_job_create()
@@ -45,14 +47,12 @@ struct initiate_ike_sa_job_t {
job_t job_interface;
/**
- * @brief Returns the currently set configuration name for this job.
- *
- * @warning Returned name is not copied.
+ * @brief Returns the connection_t to initialize
*
* @param this calling initiate_ike_sa_job_t object
- * @return name of the configuration
+ * @return connection_t
*/
- char *(*get_configuration_name) (initiate_ike_sa_job_t *this);
+ connection_t *(*get_connection) (initiate_ike_sa_job_t *this);
/**
* @brief Destroys an initiate_ike_sa_job_t object.
@@ -65,11 +65,11 @@ struct initiate_ike_sa_job_t {
/**
* @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 object
+ * @param connection connection_t to initializes
+ * @return initiate_ike_sa_job_t object
*
* @ingroup jobs
*/
-initiate_ike_sa_job_t *initiate_ike_sa_job_create(char *configuration_name);
+initiate_ike_sa_job_t *initiate_ike_sa_job_create(connection_t *connection);
#endif /*INITIATE_IKE_SA_JOB_H_*/
diff --git a/Source/charon/queues/jobs/retransmit_request_job.h b/Source/charon/queues/jobs/retransmit_request_job.h
index 5c97ec65e..2349d3f5e 100644
--- a/Source/charon/queues/jobs/retransmit_request_job.h
+++ b/Source/charon/queues/jobs/retransmit_request_job.h
@@ -20,8 +20,8 @@
* for more details.
*/
-#ifndef _RESEND_MESSAGE_JOB_H_
-#define _RESEND_MESSAGE_JOB_H_
+#ifndef RESEND_MESSAGE_JOB_H_
+#define RESEND_MESSAGE_JOB_H_
#include <types.h>
#include <queues/jobs/job.h>
@@ -102,4 +102,4 @@ struct retransmit_request_job_t {
*/
retransmit_request_job_t *retransmit_request_job_create(u_int32_t message_id,ike_sa_id_t *ike_sa_id);
-#endif //_RESEND_MESSAGE_JOB_H_
+#endif /* RESEND_MESSAGE_JOB_H_ */