- 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:
@@ -70,6 +70,8 @@ struct private_identification_t {
|
||||
id_type_t type;
|
||||
};
|
||||
|
||||
static private_identification_t *identification_create();
|
||||
|
||||
/**
|
||||
* Implementation of identification_t.get_encoding.
|
||||
*/
|
||||
@@ -113,6 +115,21 @@ static bool equals (private_identification_t *this,private_identification_t *oth
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of identification_t.clone.
|
||||
*/
|
||||
static identification_t *clone(private_identification_t *this)
|
||||
{
|
||||
private_identification_t *clone = identification_create();
|
||||
|
||||
clone->type = this->type;
|
||||
clone->encoded = allocator_clone_chunk(this->encoded);
|
||||
clone->string = allocator_alloc(strlen(this->string) + 1);
|
||||
strcpy(clone->string, this->string);
|
||||
|
||||
return &clone->public;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of identification_t.destroy.
|
||||
*/
|
||||
@@ -136,6 +153,7 @@ static private_identification_t *identification_create()
|
||||
this->public.get_encoding = (chunk_t (*) (identification_t*))get_encoding;
|
||||
this->public.get_type = (id_type_t (*) (identification_t*))get_type;
|
||||
this->public.get_string = (char* (*) (identification_t*))get_string;
|
||||
this->public.clone = (identification_t* (*) (identification_t*))clone;
|
||||
this->public.destroy = (void (*) (identification_t*))destroy;
|
||||
|
||||
this->string = NULL;
|
||||
@@ -144,6 +162,7 @@ static private_identification_t *identification_create()
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _IDENTIFICATION_H_
|
||||
#define _IDENTIFICATION_H_
|
||||
#ifndef IDENTIFICATION_H_
|
||||
#define IDENTIFICATION_H_
|
||||
|
||||
|
||||
#include "types.h"
|
||||
@@ -120,7 +120,7 @@ struct identification_t {
|
||||
*
|
||||
* @warning Result points to internal data, do NOT free!
|
||||
*
|
||||
* @param this the identification_t_object
|
||||
* @param this the identification_t object
|
||||
* @return a chunk containing the encoded bytes
|
||||
*/
|
||||
chunk_t (*get_encoding) (identification_t *this);
|
||||
@@ -128,7 +128,7 @@ struct identification_t {
|
||||
/**
|
||||
* @brief Get the type of this identification.
|
||||
*
|
||||
* @param this the identification_t_object
|
||||
* @param this the identification_t object
|
||||
* @return id_type_t
|
||||
*/
|
||||
id_type_t (*get_type) (identification_t *this);
|
||||
@@ -138,7 +138,7 @@ struct identification_t {
|
||||
*
|
||||
* @warning Result points to internal data, do NOT free!
|
||||
*
|
||||
* @param this the identification_t_object
|
||||
* @param this the identification_t object
|
||||
* @return string
|
||||
*/
|
||||
char *(*get_string) (identification_t *this);
|
||||
@@ -146,11 +146,19 @@ struct identification_t {
|
||||
/**
|
||||
* @brief Check if two identification_t objects are equal.
|
||||
*
|
||||
* @param this the identification_t_object
|
||||
* @param other other identification_t_object
|
||||
* @param this the identification_t object
|
||||
* @param other other identification_t object
|
||||
* @return TRUE if the IDs are equal
|
||||
*/
|
||||
bool (*equals) (identification_t *this,identification_t *other);
|
||||
|
||||
/**
|
||||
* @brief Clone a identification_t instance.
|
||||
*
|
||||
* @param this the identification_t object to clone
|
||||
* @return clone of this
|
||||
*/
|
||||
identification_t *(*clone) (identification_t *this);
|
||||
|
||||
/**
|
||||
* @brief Destroys a identification_t object.
|
||||
@@ -186,4 +194,4 @@ identification_t * identification_create_from_string(id_type_t type, char *strin
|
||||
identification_t * identification_create_from_encoding(id_type_t type, chunk_t encoded);
|
||||
|
||||
|
||||
#endif //_IDENTIFICATION_H_
|
||||
#endif /* IDENTIFICATION_H_ */
|
||||
|
||||
@@ -266,9 +266,9 @@ static void log_bytes(private_logger_t *this, logger_level_t loglevel, char *lab
|
||||
/**
|
||||
* Implementation of logger_t.log_chunk.
|
||||
*/
|
||||
static void log_chunk(logger_t *this, logger_level_t loglevel, char *label, chunk_t *chunk)
|
||||
static void log_chunk(logger_t *this, logger_level_t loglevel, char *label, chunk_t chunk)
|
||||
{
|
||||
this->log_bytes(this, loglevel, label, chunk->ptr, chunk->len);
|
||||
this->log_bytes(this, loglevel, label, chunk.ptr, chunk.len);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -136,9 +136,9 @@ struct logger_t {
|
||||
* @param this logger_t object
|
||||
* @param loglevel or'ed set of logger_level_t's
|
||||
* @param label a labeling name, logged with the bytes
|
||||
* @param chunk pointer to a chunk to log
|
||||
* @param chunk chunk to log
|
||||
*/
|
||||
void (*log_chunk) (logger_t *this, logger_level_t loglevel, char *label, chunk_t *chunk);
|
||||
void (*log_chunk) (logger_t *this, logger_level_t loglevel, char *label, chunk_t chunk);
|
||||
|
||||
/**
|
||||
* @brief Enables a loglevel for the current logger_t object.
|
||||
|
||||
@@ -165,7 +165,7 @@ static logger_t *create_logger(private_logger_manager_t *this, logger_context_t
|
||||
|
||||
/* defaults */
|
||||
log_thread_ids = FALSE;
|
||||
logger_level = this->public.get_logger_level(&(this->public),context);
|
||||
logger_level = this->public.get_logger_level(&(this->public), context);
|
||||
|
||||
switch(context)
|
||||
{
|
||||
@@ -176,15 +176,12 @@ static logger_t *create_logger(private_logger_manager_t *this, logger_context_t
|
||||
log_thread_ids = TRUE;
|
||||
break;
|
||||
case IKE_SA:
|
||||
logger_level |= LEVEL1;
|
||||
log_thread_ids = TRUE;
|
||||
break;
|
||||
case CHILD_SA:
|
||||
logger_level |= LEVEL1;
|
||||
log_thread_ids = TRUE;
|
||||
break;
|
||||
case CONFIG:
|
||||
logger_level |= FULL;
|
||||
log_thread_ids = TRUE;
|
||||
break;
|
||||
case MESSAGE:
|
||||
@@ -205,14 +202,12 @@ static logger_t *create_logger(private_logger_manager_t *this, logger_context_t
|
||||
case THREAD_POOL:
|
||||
break;
|
||||
case SCHEDULER:
|
||||
logger_level = 0;
|
||||
break;
|
||||
case SENDER:
|
||||
break;
|
||||
case RECEIVER:
|
||||
break;
|
||||
case SOCKET:
|
||||
logger_level |= FULL;
|
||||
break;
|
||||
case DAEMON:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user