- reworked configuration framework completly

- configuration is now split up in: connections, policies, credentials and daemon config
- further alloc/free fixes needed!
This commit is contained in:
Martin Willi
2006-03-16 15:25:06 +00:00
parent b1953ccd05
commit 16b9a73cc4
82 changed files with 1321 additions and 3401 deletions
+19 -14
View File
@@ -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);
}
@@ -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_*/
@@ -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_ */