diff options
47 files changed, 292 insertions, 291 deletions
diff --git a/Source/charon/config/configuration_manager.c b/Source/charon/config/configuration_manager.c index 05f722877..294dd3b8e 100644 --- a/Source/charon/config/configuration_manager.c +++ b/Source/charon/config/configuration_manager.c @@ -76,7 +76,7 @@ static status_t get_remote_host(private_configuration_manager_t *this, char *nam } else if (strcmp(name, "localhost") == 0) { - remote = host_create(AF_INET, "127.0.0.1", 500); + remote = host_create(AF_INET, "127.0.0.1", 4500); } else { diff --git a/Source/charon/daemon.h b/Source/charon/daemon.h index 6e90018c5..c7193bb94 100644 --- a/Source/charon/daemon.h +++ b/Source/charon/daemon.h @@ -29,7 +29,7 @@ #define NUMBER_OF_WORKING_THREADS 1 -#define IKEV2_UDP_PORT 500 +#define IKEV2_UDP_PORT 4500 #endif /*DAEMON_H_*/ diff --git a/Source/charon/definitions.h b/Source/charon/definitions.h index a0ffa66c1..3ad0b1614 100644 --- a/Source/charon/definitions.h +++ b/Source/charon/definitions.h @@ -61,40 +61,74 @@ /** - * @addtogroup config + * @defgroup config * * Configuration stuff. */ /** - * @addtogroup encoding + * @defgroup encoding * * Classes used to encode and decode IKEv2 Messages. */ + +/** + * @defgroup network + * + * Low level network stuff. + */ /** - * @addtogroup payloads + * @defgroup payloads * * Classes representing a specific IKEv2 Payload type. * * @ingroup encoding */ +/** + * @defgroup sa + * + * Security association with all helber classes. + */ + + +/** + * @defgroup states + * + * Varius states in which an IKE SA can be. + * + * @ingroup sa + */ + +/** + * @defgroup queues + * + * Different kind of queues. + */ + + /** + * @defgroup jobs + * + * Jobs used in job queue and event queue. + * + * @ingroup queues + */ /** - * @addtogroup testcases + * @defgroup testcases * * Testcases used to test the different classes in seperate module tests. */ /** - * @addtogroup transforms + * @defgroup transforms * * Transform algorithms of different kind. */ /** - * @addtogroup prfs + * @defgroup prfs * * Pseudo random functions, generate a lot of pseudo * randomness using random numbers. @@ -103,7 +137,7 @@ */ /** - * @addtogroup signers + * @defgroup signers * * Symmetric signing algorithms, used to ensure * message integrity. @@ -112,7 +146,7 @@ */ /** - * @addtogroup crypters + * @defgroup crypters * * Symmetric encryption algorithms, used to en- * and decrypt. @@ -121,7 +155,7 @@ */ /** - * @addtogroup hashers + * @defgroup hashers * * Hashing algorithms. * @@ -153,13 +187,13 @@ */ /** - * @addtogroup utils + * @defgroup utils * * Generic helper classes. */ /** - * @addtogroup threads + * @defgroup threads * * Threaded classes, which will do their * job alone. diff --git a/Source/charon/encoding/message.c b/Source/charon/encoding/message.c index ad9e0758c..700790b48 100644 --- a/Source/charon/encoding/message.c +++ b/Source/charon/encoding/message.c @@ -527,16 +527,15 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t* } } - /* colen packet for caller */ - this->packet->clone(this->packet, packet); + /* clone packet for caller */ + *packet = this->packet->clone(this->packet); this->logger->log(this->logger, CONTROL, "message generated successfully"); return SUCCESS; } /** - * Implements message_t's parse_header function. - * See #message_s.parse_header. + * Implements message_t.parse_header. */ static status_t parse_header(private_message_t *this) { diff --git a/Source/charon/network/host.h b/Source/charon/network/host.h index cf9064afd..a430d7134 100644 --- a/Source/charon/network/host.h +++ b/Source/charon/network/host.h @@ -34,10 +34,13 @@ typedef struct host_t host_t; + /** * @brief Representates a Host * * Host object, identifies a host and defines some useful functions on it. + * + * @ingroup network */ struct host_t { /** @@ -105,15 +108,17 @@ struct host_t { /** * @brief Constructor to create a host_t object * - * currently supports only IPv4! + * Currently supports only IPv4! * * @param family Address family to use for this object, such as AF_INET or AF_INET6 * @param address string of an address, such as "152.96.193.130" * @param port port number - * @return the host_t object or NULL, when - * family not supported. + * @return + * - the host_t object, or + * - NULL, when family not supported. + * + * @ingroup network */ host_t *host_create(int family, char *address, u_int16_t port); - #endif /*HOST_H_*/ diff --git a/Source/charon/network/packet.c b/Source/charon/network/packet.c index f2d7ef721..6d245365b 100644 --- a/Source/charon/network/packet.c +++ b/Source/charon/network/packet.c @@ -1,7 +1,7 @@ /** * @file packet.c * - * @brief UDP-Packet, contains data, sender and receiver. + * @brief Implementation of packet_t. * */ @@ -40,10 +40,9 @@ struct private_packet_t { }; /** - * Implements packet_t's destroy function. - * See #packet_s.destroy for description. + * Implements packet_t.destroy. */ -static status_t destroy(private_packet_t *this) +static void destroy(private_packet_t *this) { if (this->public.source != NULL) { @@ -53,32 +52,24 @@ static status_t destroy(private_packet_t *this) { this->public.destination->destroy(this->public.destination); } - if (this->public.data.ptr != NULL) - { - allocator_free(this->public.data.ptr); - } + allocator_free(this->public.data.ptr); allocator_free(this); - return SUCCESS; } /** - * Implements packet_t's clone function. - * See #packet_s.clone for description. + * Implements packet_t.clone. */ -static status_t clone (private_packet_t *this, packet_t **clone) +static packet_t *clone (private_packet_t *this) { packet_t *other; other = packet_create(); - if (other == NULL) - { - return OUT_OF_RES; - } - + if (this->public.destination != NULL) { other->destination = this->public.destination->clone(this->public.destination); } - else { + else + { other->destination = NULL; } @@ -86,7 +77,8 @@ static status_t clone (private_packet_t *this, packet_t **clone) { other->source = this->public.source->clone(this->public.source); } - else { + else + { other->source = NULL; } @@ -94,20 +86,13 @@ static status_t clone (private_packet_t *this, packet_t **clone) if (this->public.data.ptr != NULL) { other->data.ptr = allocator_clone_bytes(this->public.data.ptr,this->public.data.len); - if (other->data.ptr == NULL) - { - other->destroy(other); - return OUT_OF_RES; - } other->data.len = this->public.data.len; } else { - other->data.ptr = NULL; - other->data.len = 0; + other->data = CHUNK_INITIALIZER; } - *clone = other; - return SUCCESS; + return other; } @@ -118,13 +103,12 @@ packet_t *packet_create() { private_packet_t *this = allocator_alloc_thing(private_packet_t); - this->public.destroy = (status_t(*) (packet_t *)) destroy; - this->public.clone = (status_t(*) (packet_t *,packet_t**))clone; + this->public.destroy = (void(*) (packet_t *)) destroy; + this->public.clone = (packet_t*(*) (packet_t *))clone; this->public.destination = NULL; this->public.source = NULL; - - this->public.data.len = 0; - this->public.data.ptr = NULL; + this->public.data = CHUNK_INITIALIZER; + return &(this->public); } diff --git a/Source/charon/network/packet.h b/Source/charon/network/packet.h index 2e41e8a6c..bc8d3f5b6 100644 --- a/Source/charon/network/packet.h +++ b/Source/charon/network/packet.h @@ -1,7 +1,7 @@ /** * @file packet.h * - * @brief UDP-Packet, contains data, sender and receiver. + * @brief Interface of packet_t. * */ @@ -30,7 +30,9 @@ typedef struct packet_t packet_t; /** - * @brief UDP-Packet, contains data, sender and receiver + * @brief Abstraction of an UDP-Packet, contains data, sender and receiver. + * + * @ingroup network */ struct packet_t { @@ -50,28 +52,27 @@ struct packet_t { chunk_t data; /** - * @brief Clones a packet_t object + * @brief Clones a packet_t object. * - * @param packet calling object + * @param packet calling object * @param clone pointer to a packet_t object pointer where the new object is stored - * @return - SUCCESS if successful - * - OUT_OF_RES */ - status_t (*clone) (packet_t *packet, packet_t **clone); + packet_t* (*clone) (packet_t *packet); /** - * @brief destroy the packet, freeing contained data + * @brief Destroy the packet, freeing contained data. * * @param packet packet to destroy - * @return - SUCCESS */ - status_t (*destroy) (packet_t *packet); + void (*destroy) (packet_t *packet); }; /** * @brief create an empty packet * - * @return - NULL when family not supported + * @return created packet_t object + * + * @ingroup network */ packet_t *packet_create(); diff --git a/Source/charon/network/socket.c b/Source/charon/network/socket.c index f56d22ade..41a2224b8 100644 --- a/Source/charon/network/socket.c +++ b/Source/charon/network/socket.c @@ -1,9 +1,7 @@ /** * @file socket.c * - * @brief management of sockets - * - * receiver reads from here, sender writes to here + * @brief Implementation of socket_t. * */ @@ -52,6 +50,7 @@ struct private_socket_t{ * currently we only have one socket, maybe more in the future ? */ int socket_fd; + /** * logger for this socket */ @@ -137,13 +136,11 @@ status_t sender(private_socket_t *this, packet_t *packet) /** * implementation of socket_t.destroy */ -status_t destroy(private_socket_t *this) +void destroy(private_socket_t *this) { close(this->socket_fd); global_logger_manager->destroy_logger(global_logger_manager, this->logger); allocator_free(this); - - return SUCCESS; } socket_t *socket_create(u_int16_t port) @@ -154,15 +151,9 @@ socket_t *socket_create(u_int16_t port) /* public functions */ this->public.send = (status_t(*)(socket_t*, packet_t*))sender; this->public.receive = (status_t(*)(socket_t*, packet_t**))receiver; - this->public.destroy = (status_t(*)(socket_t*))destroy; - + this->public.destroy = (void(*)(socket_t*))destroy; this->logger = global_logger_manager->create_logger(global_logger_manager, SOCKET, NULL); - if (this->logger == NULL) - { - allocator_free(this); - return NULL; - } /* create default ipv4 socket */ this->socket_fd = socket(PF_INET, SOCK_DGRAM, 0); diff --git a/Source/charon/network/socket.h b/Source/charon/network/socket.h index 97f59ac02..752e5d62b 100644 --- a/Source/charon/network/socket.h +++ b/Source/charon/network/socket.h @@ -1,9 +1,7 @@ /** * @file socket.h * - * @brief management of sockets - * - * receiver reads from here, sender writes to here + * @brief Interface for socket_t. * */ @@ -31,8 +29,11 @@ /** - * maximum size of a packet + * @brief Maximum size of a packet. + * * 3000 Bytes should be sufficient, see IKEv2 draft + * + * @ingroup network */ #define MAX_PACKET 3000 @@ -40,12 +41,15 @@ typedef struct socket_t socket_t; /** - * @brief abstraction of one (ipv4), or in future, of multiple sockets + * @brief Abstraction of one (ipv4), or in future, of multiple sockets. + * + * Receiver reads from here, sender writes to here. * + * @ingroup network */ struct socket_t { /** - * @brief receive a packet + * @brief Receive a packet. * * reads a packet from one of the sockets. * source will be set, dest not implemented @@ -59,7 +63,7 @@ struct socket_t { status_t (*receive) (socket_t *sock, packet_t **packet); /** - * @brief send a packet + * @brief Send a packet. * * sends a packet via desired socket. * uses source and dest in packet. @@ -72,24 +76,26 @@ struct socket_t { status_t (*send) (socket_t *sock, packet_t *packet); /** - * @brief destroy sockets + * @brief Destroy sockets. * * close sockets and destroy socket_t object * * @param sock socket_t to destroy * @return SUCCESS */ - status_t (*destroy) (socket_t *sock); + void (*destroy) (socket_t *sock); }; /** - * @brief socket_t constructor + * @brief socket_t constructor. * * currently creates one socket, listening on all addresses * on port. * * @param port port to bind socket to * @return the created socket, or NULL on error + * + * @ingroup network */ socket_t *socket_create(u_int16_t port); 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(); diff --git a/Source/charon/sa/ike_sa.c b/Source/charon/sa/ike_sa.c index 33a7fd388..91ab32390 100644 --- a/Source/charon/sa/ike_sa.c +++ b/Source/charon/sa/ike_sa.c @@ -1,8 +1,7 @@ /** * @file ike_sa.c * - * @brief Class ike_sa_t. An object of this type is managed by an - * ike_sa_manager_t object and represents an IKE_SA + * @brief Implementation of ike_sa_t. * */ @@ -57,7 +56,6 @@ struct private_ike_sa_t { */ protected_ike_sa_t protected; - /** * Creates a job to delete the given IKE_SA. * diff --git a/Source/charon/sa/ike_sa.h b/Source/charon/sa/ike_sa.h index 9545822fd..b4abfa48c 100644 --- a/Source/charon/sa/ike_sa.h +++ b/Source/charon/sa/ike_sa.h @@ -38,6 +38,8 @@ /** * Nonce size in bytes of all sent nonces + * + * @ingroup sa */ #define NONCE_SIZE 16 @@ -46,6 +48,8 @@ typedef struct ike_sa_t ike_sa_t; /** * @brief Class ike_sa_t. An object of this type is managed by an * ike_sa_manager_t object and represents an IKE_SA. + * + * @ingroup sa */ struct ike_sa_t { @@ -90,6 +94,8 @@ typedef struct protected_ike_sa_t protected_ike_sa_t; * * This members should only be accessed from * the varius state classes. + * + * @ingroup sa */ struct protected_ike_sa_t { @@ -239,6 +245,8 @@ struct protected_ike_sa_t { * e.g. when a IKE_SA_INIT has been finished. * * @return created ike_sa_t object + * + * @ingroup sa */ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id); diff --git a/Source/charon/sa/ike_sa_id.c b/Source/charon/sa/ike_sa_id.c index f5c93cf47..ebc721918 100644 --- a/Source/charon/sa/ike_sa_id.c +++ b/Source/charon/sa/ike_sa_id.c @@ -56,7 +56,6 @@ struct private_ike_sa_id_t { }; - /** * implements ike_sa_id_t.set_responder_spi. */ @@ -94,7 +93,7 @@ static u_int64_t get_responder_spi (private_ike_sa_id_t *this) */ static bool equals (private_ike_sa_id_t *this, private_ike_sa_id_t *other) { - if ((this == NULL)||(other == NULL)) + if (other == NULL) { return FALSE; } diff --git a/Source/charon/sa/ike_sa_id.h b/Source/charon/sa/ike_sa_id.h index 2b4b643d3..0df752496 100644 --- a/Source/charon/sa/ike_sa_id.h +++ b/Source/charon/sa/ike_sa_id.h @@ -34,6 +34,8 @@ typedef struct ike_sa_id_t ike_sa_id_t; * An IKE_SA is identified by its initiator and responder spi's. * Additionaly it contains the role of the actual running IKEv2-Daemon * for the specific IKE_SA. + * + * @ingroup sa */ struct ike_sa_id_t { @@ -131,6 +133,8 @@ struct ike_sa_id_t { * @param responder_spi responders spi * @param is_initiator TRUE if we are the original initiator * @return created ike_sa_id_t object + * + * @ingroup sa */ ike_sa_id_t * ike_sa_id_create(u_int64_t initiator_spi, u_int64_t responder_spi, bool is_initiaor); diff --git a/Source/charon/sa/ike_sa_manager.c b/Source/charon/sa/ike_sa_manager.c index 698d69315..943502dcb 100644 --- a/Source/charon/sa/ike_sa_manager.c +++ b/Source/charon/sa/ike_sa_manager.c @@ -1,7 +1,7 @@ /** * @file ike_sa_manager.c * - * @brief Central point for managing IKE-SAs (creation, locking, deleting...) + * @brief Implementation of ike_sa_mananger_t. * */ @@ -35,7 +35,7 @@ typedef struct ike_sa_entry_t ike_sa_entry_t; /** - * @brief An entry in the linked list, contains IKE_SA, locking and lookup data. + * An entry in the linked list, contains IKE_SA, locking and lookup data. */ struct ike_sa_entry_t { /** @@ -73,7 +73,7 @@ struct ike_sa_entry_t { }; /** - * @see ike_sa_entry_t.destroy + * Implements ike_sa_entry_t.destroy. */ static status_t ike_sa_entry_destroy(ike_sa_entry_t *this) { @@ -87,7 +87,7 @@ static status_t ike_sa_entry_destroy(ike_sa_entry_t *this) /** * @brief creates a new entry for the ike_sa list * - * This constructor additionaly creates a new and empty SA + * This constructor additionaly creates a new and empty SA. * * @param ike_sa_id the associated ike_sa_id_t, will be cloned * @return created entry, with ike_sa and ike_sa_id @@ -130,7 +130,7 @@ struct private_ike_sa_manager_t { /** * @brief get next spi * - * we give out SPIs incremental + * we give out SPIs incremental. * * @param this the ike_sa_manager * @return the next spi @@ -138,7 +138,7 @@ struct private_ike_sa_manager_t { u_int64_t (*get_next_spi) (private_ike_sa_manager_t *this); /** - * @brief find the ike_sa_entry in the list by SPIs + * @brief find the ike_sa_entry in the list by SPIs. * * This function simply iterates over the linked list. A hash-table * would be more efficient when storing a lot of IKE_SAs... @@ -199,7 +199,6 @@ struct private_ike_sa_manager_t { u_int64_t next_spi; }; - /** * Implements private_ike_sa_manager_t.get_entry_by_id. */ @@ -468,8 +467,7 @@ static status_t checkout(private_ike_sa_manager_t *this, ike_sa_id_t *ike_sa_id, } /** - * Implements ike_sa_manager_t-function checkin. - * @see ike_sa_manager_t.checkin. + * Implements ike_sa_manager_t.checkin. */ static status_t checkin(private_ike_sa_manager_t *this, ike_sa_t *ike_sa) { @@ -506,8 +504,7 @@ static status_t checkin(private_ike_sa_manager_t *this, ike_sa_t *ike_sa) /** - * Implements ike_sa_manager_t-function checkin_and_delete. - * @see ike_sa_manager_t.checkin_and_delete. + * Implements ike_sa_manager_t.checkin_and_delete. */ static status_t checkin_and_delete(private_ike_sa_manager_t *this, ike_sa_t *ike_sa) { diff --git a/Source/charon/sa/ike_sa_manager.h b/Source/charon/sa/ike_sa_manager.h index ae54e618a..e86cfe83c 100644 --- a/Source/charon/sa/ike_sa_manager.h +++ b/Source/charon/sa/ike_sa_manager.h @@ -38,7 +38,8 @@ typedef struct ike_sa_manager_t ike_sa_manager_t; * * @todo checking of double-checkouts from the same threads would be nice. * This could be by comparing thread-ids via pthread_self()... - * + * + * @ingroup sa */ struct ike_sa_manager_t { /** @@ -128,6 +129,8 @@ struct ike_sa_manager_t { * @brief Create a manager * * @returns the created manager + * + * @ingroup sa */ ike_sa_manager_t *ike_sa_manager_create(); diff --git a/Source/charon/sa/states/ike_auth_requested.c b/Source/charon/sa/states/ike_auth_requested.c index 28ff3a0f5..9f7d5b958 100644 --- a/Source/charon/sa/states/ike_auth_requested.c +++ b/Source/charon/sa/states/ike_auth_requested.c @@ -1,7 +1,7 @@ /** * @file ike_auth_requested.c * - * @brief State of an IKE_SA, which has requested an IKE_AUTH. + * @brief Implementation of ike_auth_requested_t. * */ diff --git a/Source/charon/sa/states/ike_auth_requested.h b/Source/charon/sa/states/ike_auth_requested.h index 2b8bc776a..c75a65ff2 100644 --- a/Source/charon/sa/states/ike_auth_requested.h +++ b/Source/charon/sa/states/ike_auth_requested.h @@ -1,7 +1,7 @@ /** * @file ike_auth_requested.h * - * @brief State of an IKE_SA, which has requested an IKE_AUTH. + * @brief Interface of ike_auth_requested_t. * */ @@ -31,7 +31,8 @@ typedef struct ike_auth_requested_t ike_auth_requested_t; /** * @brief This class represents an IKE_SA, which has requested an IKE_AUTH. - * + * + * @ingroup states */ struct ike_auth_requested_t { /** @@ -45,6 +46,9 @@ struct ike_auth_requested_t { * Constructor of class ike_auth_requested_t * * @param ike_sa assigned ike_sa object + * @return created ike_auth_requested_t object + * + * @ingroup states */ ike_auth_requested_t *ike_auth_requested_create(protected_ike_sa_t *ike_sa); diff --git a/Source/charon/sa/states/ike_sa_established.c b/Source/charon/sa/states/ike_sa_established.c index d1f9a6bd7..99e9a7291 100644 --- a/Source/charon/sa/states/ike_sa_established.c +++ b/Source/charon/sa/states/ike_sa_established.c @@ -1,7 +1,7 @@ /** * @file ike_sa_established.c * - * @brief State of an established IKE_SA. + * @brief Implementation of ike_sa_established_t. * */ @@ -29,7 +29,6 @@ typedef struct private_ike_sa_established_t private_ike_sa_established_t; /** * Private data of a ike_sa_established_t object. - * */ struct private_ike_sa_established_t { /** diff --git a/Source/charon/sa/states/ike_sa_established.h b/Source/charon/sa/states/ike_sa_established.h index 68581d155..6afc495cb 100644 --- a/Source/charon/sa/states/ike_sa_established.h +++ b/Source/charon/sa/states/ike_sa_established.h @@ -1,7 +1,7 @@ /** * @file ike_sa_established.h * - * @brief State of an established IKE_SA. + * @brief Interface of ike_sa_established_t. * */ @@ -29,9 +29,10 @@ typedef struct ike_sa_established_t ike_sa_established_t; /** - * @brief This class represents an the state of an established. + * @brief This class represents an the state of an established * IKE_SA. - * + * + * @ingroup states */ struct ike_sa_established_t { /** @@ -44,7 +45,10 @@ struct ike_sa_established_t { /** * Constructor of class ike_sa_established_t * - * @param ike_sa assigned ike_sa + * @param ike_sa assigned ike_sa + * @return created ike_sa_established_t object + * + * @ingroup states */ ike_sa_established_t *ike_sa_established_create(protected_ike_sa_t *ike_sa); diff --git a/Source/charon/sa/states/ike_sa_init_requested.c b/Source/charon/sa/states/ike_sa_init_requested.c index f301b307d..d682a769c 100644 --- a/Source/charon/sa/states/ike_sa_init_requested.c +++ b/Source/charon/sa/states/ike_sa_init_requested.c @@ -1,7 +1,7 @@ /** * @file ike_sa_init_requested.c * - * @brief State of a IKE_SA after requesting an IKE_SA_INIT + * @brief Implementation of ike_sa_init_requested_t. * */ diff --git a/Source/charon/sa/states/ike_sa_init_requested.h b/Source/charon/sa/states/ike_sa_init_requested.h index 0c1c01b67..01bef9357 100644 --- a/Source/charon/sa/states/ike_sa_init_requested.h +++ b/Source/charon/sa/states/ike_sa_init_requested.h @@ -1,7 +1,7 @@ /** * @file ike_sa_init_requested.h * - * @brief State of a IKE_SA after requesting an IKE_SA_INIT + * @brief Interface of ike_sa_init_requestet_t. * */ @@ -33,22 +33,25 @@ typedef struct ike_sa_init_requested_t ike_sa_init_requested_t; /** * @brief This class represents an IKE_SA state when requested an IKE_SA_INIT. - * + * + * @ingroup states */ struct ike_sa_init_requested_t { /** * methods of the state_t interface */ state_t state_interface; - }; /** * Constructor of class ike_sa_init_responded_t * - * @param ike_sa assigned ike_sa + * @param ike_sa assigned ike_sa * @param diffie_hellman diffie_hellman object use to retrieve shared secret * @param sent_nonce Sent nonce value + * @return created ike_sa_init_request_t object + * + * @ingroup states */ ike_sa_init_requested_t *ike_sa_init_requested_create(protected_ike_sa_t *ike_sa, u_int16_t dh_group_priority, diffie_hellman_t *diffie_hellman, chunk_t sent_nonce); diff --git a/Source/charon/sa/states/ike_sa_init_responded.c b/Source/charon/sa/states/ike_sa_init_responded.c index c4f7e2d54..8725a001a 100644 --- a/Source/charon/sa/states/ike_sa_init_responded.c +++ b/Source/charon/sa/states/ike_sa_init_responded.c @@ -87,7 +87,7 @@ static ike_sa_state_t get_state(private_ike_sa_init_responded_t *this) /** * Implements state_t.get_state */ -static status_t destroy(private_ike_sa_init_responded_t *this) +static void destroy(private_ike_sa_init_responded_t *this) { this->logger->log(this->logger, CONTROL | MORE, "Going to destroy ike_sa_init_responded_t state object"); @@ -101,7 +101,6 @@ static status_t destroy(private_ike_sa_init_responded_t *this) allocator_free(this->received_nonce.ptr); allocator_free(this); - return SUCCESS; } /* diff --git a/Source/charon/sa/states/ike_sa_init_responded.h b/Source/charon/sa/states/ike_sa_init_responded.h index 2e1fabc1d..aa07f76b9 100644 --- a/Source/charon/sa/states/ike_sa_init_responded.h +++ b/Source/charon/sa/states/ike_sa_init_responded.h @@ -29,8 +29,10 @@ typedef struct ike_sa_init_responded_t ike_sa_init_responded_t; /** - * @brief This class represents an IKE_SA state when responded to an IKE_SA_INIT request. - * + * @brief This class represents an IKE_SA state when + * responded to an IKE_SA_INIT request. + * + * @ingroup states */ struct ike_sa_init_responded_t { /** @@ -41,9 +43,12 @@ struct ike_sa_init_responded_t { }; /** - * Constructor of class ike_sa_init_responded_t + * @brief Constructor of class ike_sa_init_responded_t + * + * @param ike_sa assigned IKE_SA + * @todo Params description * - * @param ike_sa assigned IKE_SA + * @ingroup states */ ike_sa_init_responded_t *ike_sa_init_responded_create(protected_ike_sa_t *ike_sa, chunk_t shared_secret, chunk_t received_nonce, chunk_t sent_nonce); diff --git a/Source/charon/sa/states/initiator_init.h b/Source/charon/sa/states/initiator_init.h index c150eb6b1..f8c9e398b 100644 --- a/Source/charon/sa/states/initiator_init.h +++ b/Source/charon/sa/states/initiator_init.h @@ -1,7 +1,7 @@ /** * @file initiator_init.h * - * @brief Start state of a IKE_SA as initiator + * @brief Interface of initiator_init_t. * */ @@ -33,7 +33,8 @@ typedef struct initiator_init_t initiator_init_t; /** * @brief This class represents an IKE_SA state when initializing. * a connection as initiator - * + * + * @ingroup states */ struct initiator_init_t { /** @@ -52,9 +53,11 @@ struct initiator_init_t { }; /** - * Constructor of class initiator_init_t + * @brief Constructor of class initiator_init_t * * @param ike_sa assigned IKE_SA + * + * @ingroup states */ initiator_init_t *initiator_init_create(protected_ike_sa_t *ike_sa); diff --git a/Source/charon/sa/states/responder_init.h b/Source/charon/sa/states/responder_init.h index 1606579ab..8fe1c2919 100644 --- a/Source/charon/sa/states/responder_init.h +++ b/Source/charon/sa/states/responder_init.h @@ -32,7 +32,8 @@ typedef struct responder_init_t responder_init_t; /** * @brief This class represents an IKE_SA state when initializing. * a connection as responder. - * + * + * @ingroup states */ struct responder_init_t { /** @@ -48,6 +49,8 @@ struct responder_init_t { * @param ike_sa assigned IKE_SA * * @return responder_init state + * + * @ingroup states */ responder_init_t *responder_init_create(protected_ike_sa_t *ike_sa); diff --git a/Source/charon/sa/states/state.c b/Source/charon/sa/states/state.c index 661eaa39a..7e6635c23 100644 --- a/Source/charon/sa/states/state.c +++ b/Source/charon/sa/states/state.c @@ -1,7 +1,7 @@ /** * @file state.c * - * @brief Interface for a specific IKE_SA state + * @brief Interface additions to ike_sa_sate_t. * */ diff --git a/Source/charon/sa/states/state.h b/Source/charon/sa/states/state.h index 471822f88..e19253f8e 100644 --- a/Source/charon/sa/states/state.h +++ b/Source/charon/sa/states/state.h @@ -1,7 +1,7 @@ /** * @file state.h * - * @brief Interface for a specific IKE_SA state. + * @brief Interface ike_sa_sate_t. * */ @@ -33,6 +33,8 @@ typedef enum ike_sa_state_t ike_sa_state_t; /** * States in which a IKE_SA can actually be + * + * @ingroup states */ enum ike_sa_state_t { @@ -79,6 +81,8 @@ typedef struct state_t state_t; /** * @brief This interface represents an IKE_SA state + * + * @ingroup states */ struct state_t { @@ -109,5 +113,4 @@ struct state_t { void (*destroy) (state_t *this); }; - #endif /*STATE_H_*/ diff --git a/Source/charon/testcases/event_queue_test.c b/Source/charon/testcases/event_queue_test.c index 6982f4110..e34ac6067 100644 --- a/Source/charon/testcases/event_queue_test.c +++ b/Source/charon/testcases/event_queue_test.c @@ -133,8 +133,7 @@ void test_event_queue(tester_t *tester) job = event_queue->get(event_queue); gettimeofday(¤t_time,NULL); tester->assert_true(tester,((current_time.tv_sec - start_time.tv_sec) == i), "value of entry check"); - tester->assert_true(tester,(job->destroy(job) == SUCCESS), "job destroy call check"); - + job->destroy(job); } } diff --git a/Source/charon/testcases/job_queue_test.c b/Source/charon/testcases/job_queue_test.c index a8d266a37..25fb830e0 100644 --- a/Source/charon/testcases/job_queue_test.c +++ b/Source/charon/testcases/job_queue_test.c @@ -80,7 +80,7 @@ static void test_job_queue_receiver(job_queue_test_t * testinfo) job_t *job; job = testinfo->job_queue->get(testinfo->job_queue); testinfo->tester->assert_true(testinfo->tester,(job->get_type(job) == INITIATE_IKE_SA), "job type check"); - testinfo->tester->assert_true(testinfo->tester,(job->destroy(job) == SUCCESS), "job destroy call check"); + job->destroy(job); } } diff --git a/Source/charon/testcases/packet_test.c b/Source/charon/testcases/packet_test.c index e5f871681..28a90be58 100644 --- a/Source/charon/testcases/packet_test.c +++ b/Source/charon/testcases/packet_test.c @@ -46,7 +46,7 @@ void test_packet(tester_t *tester) strcpy(packet->data.ptr,string_to_copy); tester->assert_true(tester,(packet != NULL),"NULL pointer check"); - tester->assert_true(tester,(packet->clone(packet,&packet2) == SUCCESS),"clone call check"); + packet2 = packet->clone(packet); tester->assert_false(tester,(packet->data.ptr == packet2->data.ptr),"value pointer check"); diff --git a/Source/charon/testcases/receiver_test.c b/Source/charon/testcases/receiver_test.c index 0d01617bc..af3265096 100644 --- a/Source/charon/testcases/receiver_test.c +++ b/Source/charon/testcases/receiver_test.c @@ -75,7 +75,7 @@ void test_receiver(tester_t *tester) job = global_job_queue->get(global_job_queue); tester->assert_true(tester, (job->get_type(job) == INCOMING_PACKET), "job type check"); - ((incoming_packet_job_t *)(job))->get_packet((incoming_packet_job_t *)(job),&received_packet); + received_packet = ((incoming_packet_job_t *)(job))->get_packet((incoming_packet_job_t *)(job)); tester->assert_true(tester, (received_packet->data.len == (sizeof(int))), "received data length check"); tester->assert_true(tester, (i == *((int *)(received_packet->data.ptr))), "received data value check"); received_packet->destroy(received_packet); diff --git a/Source/charon/testcases/scheduler_test.c b/Source/charon/testcases/scheduler_test.c index eb8a860f0..e8ba827f4 100644 --- a/Source/charon/testcases/scheduler_test.c +++ b/Source/charon/testcases/scheduler_test.c @@ -81,7 +81,7 @@ void test_scheduler(tester_t *tester) incoming_packet_job_t *current_job; current_job = (incoming_packet_job_t*) jobs[current]; packet_t *packet; - current_job->get_packet(current_job,&packet); + packet = current_job->get_packet(current_job); tester->assert_true(tester, (((int)packet) == current+1), "job order"); jobs[current]->destroy(jobs[current]); diff --git a/Source/charon/testcases/send_queue_test.c b/Source/charon/testcases/send_queue_test.c index df72eef06..35f6ebfd6 100644 --- a/Source/charon/testcases/send_queue_test.c +++ b/Source/charon/testcases/send_queue_test.c @@ -88,7 +88,7 @@ static void test_send_queue_receiver(send_queue_test_t * testinfo) testinfo->tester->assert_true(testinfo->tester,( packet != NULL), "packet not NULL call check"); - testinfo->tester->assert_true(testinfo->tester,( packet->destroy(packet) == SUCCESS), "packet destroy call check"); + packet->destroy(packet); } } diff --git a/Source/charon/testcases/socket_test.c b/Source/charon/testcases/socket_test.c index 823d2d5cb..03117c555 100644 --- a/Source/charon/testcases/socket_test.c +++ b/Source/charon/testcases/socket_test.c @@ -65,6 +65,6 @@ void test_socket(tester_t *tester) pkt->destroy(pkt); } - tester->assert_true(tester, (skt->destroy(skt) == SUCCESS), "socket destroy call check"); + skt->destroy(skt); } diff --git a/Source/charon/threads/thread_pool.c b/Source/charon/threads/thread_pool.c index 8e8bd8f99..58310ebc5 100644 --- a/Source/charon/threads/thread_pool.c +++ b/Source/charon/threads/thread_pool.c @@ -159,19 +159,10 @@ static void process_incoming_packet_job(private_thread_pool_t *this, incoming_pa ike_sa_id_t *ike_sa_id; status_t status; - if (job->get_packet(job,&packet) != SUCCESS) - { - this->worker_logger->log(this->worker_logger, ERROR, "packet in job could not be retrieved!"); - return; - } + + packet = job->get_packet(job); message = message_create_from_packet(packet); - if (message == NULL) - { - this->worker_logger->log(this->worker_logger, ERROR, "message could not be created from packet!"); - packet->destroy(packet); - return; - } status = message->parse_header(message); if (status != SUCCESS) @@ -194,13 +185,7 @@ static void process_incoming_packet_job(private_thread_pool_t *this, incoming_pa /* Todo send notify */ } - status = message->get_ike_sa_id(message, &ike_sa_id); - if (status != SUCCESS) - { - this->worker_logger->log(this->worker_logger, ERROR, "IKE SA ID of message could not be created!"); - message->destroy(message); - return; - } + message->get_ike_sa_id(message, &ike_sa_id); ike_sa_id->switch_initiator(ike_sa_id); diff --git a/Source/charon/utils/randomizer.h b/Source/charon/utils/randomizer.h index b5dc3780a..c993782e4 100644 --- a/Source/charon/utils/randomizer.h +++ b/Source/charon/utils/randomizer.h @@ -32,6 +32,8 @@ typedef struct randomizer_t randomizer_t; * * This class is thread save as file system read calls are thread save. * + * @todo fix FEHLVERHALTEN + * * @ingroup utils */ struct randomizer_t { |