diff options
Diffstat (limited to 'Source/charon')
61 files changed, 302 insertions, 241 deletions
diff --git a/Source/charon/daemon.h b/Source/charon/daemon.h index 3d83286b1..abf472da3 100644 --- a/Source/charon/daemon.h +++ b/Source/charon/daemon.h @@ -29,7 +29,7 @@ #define NUMBER_OF_WORKING_THREADS 4 -#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 c3c481af7..784d1643a 100644 --- a/Source/charon/definitions.h +++ b/Source/charon/definitions.h @@ -60,6 +60,22 @@ #endif /** + * Doxygen namespace support + */ + + +/** + * @addtogroup transforms + */ + +/** + * @addtogroup prfs + * + * @ingroup transforms + */ + + +/** * macro gives back larger of two values */ #define max(x,y) (x > y ? x : y) @@ -76,11 +92,12 @@ */ #define MAPPING_END (-1) +typedef struct mapping_t mapping_t; + /** - * @brief mapping entry, where enum-to-string mappings are stored + * @brief mapping entry, where enum-to-string mappings are stored. */ -typedef struct mapping_s mapping_t; -struct mapping_s +struct mapping_t { /** * enumeration value diff --git a/Source/charon/encoding/message.c b/Source/charon/encoding/message.c index db6efb369..4ec78050e 100644 --- a/Source/charon/encoding/message.c +++ b/Source/charon/encoding/message.c @@ -114,13 +114,13 @@ static message_rule_t message_rules[] = { {IKE_SA_INIT,FALSE,(sizeof(supported_ike_sa_init_r_payloads)/sizeof(supported_payload_entry_t)),supported_ike_sa_init_r_payloads} }; +typedef struct payload_entry_t payload_entry_t; + /** * Entry for a payload in the internal used linked list * */ -typedef struct payload_entry_s payload_entry_t; - -struct payload_entry_s { +struct payload_entry_t { /** * Type of payload */ @@ -132,12 +132,12 @@ struct payload_entry_s { }; +typedef struct private_message_t private_message_t; + /** * Private data of an message_t object */ -typedef struct private_message_s private_message_t; - -struct private_message_s { +struct private_message_t { /** * Public part of a message_t object diff --git a/Source/charon/encoding/payloads/encodings.h b/Source/charon/encoding/payloads/encodings.h index b6814f303..25e317549 100644 --- a/Source/charon/encoding/payloads/encodings.h +++ b/Source/charon/encoding/payloads/encodings.h @@ -333,9 +333,9 @@ extern mapping_t encoding_type_m[]; * * This rules are used by parser and generator. */ -typedef struct encoding_rule_s encoding_rule_t; +typedef struct encoding_rule_t encoding_rule_t; -struct encoding_rule_s{ +struct encoding_rule_t { /** * Encoding type */ diff --git a/Source/charon/sa/ike_sa.h b/Source/charon/sa/ike_sa.h index 34e95ab9a..8a1ed0000 100644 --- a/Source/charon/sa/ike_sa.h +++ b/Source/charon/sa/ike_sa.h @@ -41,13 +41,13 @@ */ #define NONCE_SIZE 16 +typedef struct ike_sa_t ike_sa_t; + /** * @brief This class is used to represent an IKE_SA * */ -typedef struct ike_sa_s ike_sa_t; - -struct ike_sa_s { +struct ike_sa_t { /** * @brief Processes a incoming IKEv2-Message of type message_t @@ -84,12 +84,12 @@ struct ike_sa_s { status_t (*destroy) (ike_sa_t *this); }; +typedef struct protected_ike_sa_t protected_ike_sa_t; + /** * Protected data of an ike_sa_t object */ -typedef struct protected_ike_sa_s protected_ike_sa_t; - -struct protected_ike_sa_s { +struct protected_ike_sa_t { /** * Public part of a ike_sa_t object diff --git a/Source/charon/sa/ike_sa_id.c b/Source/charon/sa/ike_sa_id.c index 52b1a9c8d..542959558 100644 --- a/Source/charon/sa/ike_sa_id.c +++ b/Source/charon/sa/ike_sa_id.c @@ -28,12 +28,12 @@ #include <types.h> #include <utils/allocator.h> +typedef struct private_ike_sa_id_t private_ike_sa_id_t; + /** * Private data of an ike_sa_id object */ -typedef struct private_ike_sa_id_s private_ike_sa_id_t; - -struct private_ike_sa_id_s { +struct private_ike_sa_id_t { /** * Public part of a ike_sa_id object */ diff --git a/Source/charon/sa/ike_sa_id.h b/Source/charon/sa/ike_sa_id.h index f7e0e6540..7eb8a326d 100644 --- a/Source/charon/sa/ike_sa_id.h +++ b/Source/charon/sa/ike_sa_id.h @@ -26,6 +26,8 @@ #include "types.h" +typedef struct ike_sa_id_t ike_sa_id_t; + /** * @brief This class is used to identify an IKE_SA. * @@ -33,9 +35,7 @@ * Additionaly it contains the role of the actual running IKEv2-Daemon * for the specific IKE_SA. */ -typedef struct ike_sa_id_s ike_sa_id_t; - -struct ike_sa_id_s { +struct ike_sa_id_t { /** * @brief Sets the SPI of the responder. diff --git a/Source/charon/sa/ike_sa_manager.c b/Source/charon/sa/ike_sa_manager.c index def7d6d40..55fd0fcd6 100644 --- a/Source/charon/sa/ike_sa_manager.c +++ b/Source/charon/sa/ike_sa_manager.c @@ -32,11 +32,12 @@ #include <utils/logger_manager.h> #include <utils/linked_list.h> +typedef struct ike_sa_entry_t ike_sa_entry_t; + /** * @brief An entry in the linked list, contains IKE_SA, locking and lookup data. */ -typedef struct ike_sa_entry_s ike_sa_entry_t; -struct ike_sa_entry_s { +struct ike_sa_entry_t { /** * destructor, also destroys ike_sa */ @@ -131,11 +132,12 @@ static ike_sa_entry_t *ike_sa_entry_create(ike_sa_id_t *ike_sa_id) return this; } +typedef struct private_ike_sa_manager_t private_ike_sa_manager_t; + /** * Additional private members to ike_sa_manager_t */ -typedef struct private_ike_sa_manager_s private_ike_sa_manager_t; -struct private_ike_sa_manager_s { +struct private_ike_sa_manager_t { /** * Public members */ diff --git a/Source/charon/sa/ike_sa_manager.h b/Source/charon/sa/ike_sa_manager.h index 25d6c4c1a..1481ebb40 100644 --- a/Source/charon/sa/ike_sa_manager.h +++ b/Source/charon/sa/ike_sa_manager.h @@ -27,19 +27,20 @@ #include <sa/ike_sa.h> +typedef struct ike_sa_manager_t ike_sa_manager_t; + /** - * @brief The IKE_SA-Manager manages the IKE_SAs ;-). - * + * @brief The IKE_SA-Manager manages the IKE_SAs ;-). + * * To avoid access from multiple threads, IKE_SAs must be checked out from * the manager, and checked back in after usage. * The manager also handles deletion of SAs. - * + * * @todo checking of double-checkouts from the same threads would be nice. * This could be by comparing thread-ids via pthread_self()... - * + * */ -typedef struct ike_sa_manager_s ike_sa_manager_t; -struct ike_sa_manager_s { +struct ike_sa_manager_t { /** * @brief Checkout an IKE_SA, create it when necesarry * diff --git a/Source/charon/sa/states/ike_auth_requested.c b/Source/charon/sa/states/ike_auth_requested.c index b1033eb62..4681b64b0 100644 --- a/Source/charon/sa/states/ike_auth_requested.c +++ b/Source/charon/sa/states/ike_auth_requested.c @@ -24,12 +24,14 @@ #include <utils/allocator.h> + +typedef struct private_ike_auth_requested_t private_ike_auth_requested_t; + /** * Private data of a ike_auth_requested_t object. * */ -typedef struct private_ike_auth_requested_s private_ike_auth_requested_t; -struct private_ike_auth_requested_s { +struct private_ike_auth_requested_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/ike_auth_requested.h b/Source/charon/sa/states/ike_auth_requested.h index f7e58e9ff..2b8bc776a 100644 --- a/Source/charon/sa/states/ike_auth_requested.h +++ b/Source/charon/sa/states/ike_auth_requested.h @@ -26,13 +26,14 @@ #include <sa/states/state.h> #include <sa/ike_sa.h> + +typedef struct ike_auth_requested_t ike_auth_requested_t; + /** * @brief This class represents an IKE_SA, which has requested an IKE_AUTH. * */ -typedef struct ike_auth_requested_s ike_auth_requested_t; - -struct ike_auth_requested_s { +struct ike_auth_requested_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/ike_sa_established.c b/Source/charon/sa/states/ike_sa_established.c index 0a0dd4b75..769ac8c4c 100644 --- a/Source/charon/sa/states/ike_sa_established.c +++ b/Source/charon/sa/states/ike_sa_established.c @@ -24,12 +24,14 @@ #include <utils/allocator.h> + +typedef struct private_ike_sa_established_t private_ike_sa_established_t; + /** * Private data of a ike_sa_established_t object. * */ -typedef struct private_ike_sa_established_s private_ike_sa_established_t; -struct private_ike_sa_established_s { +struct private_ike_sa_established_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/ike_sa_established.h b/Source/charon/sa/states/ike_sa_established.h index 3ecdd1df1..68581d155 100644 --- a/Source/charon/sa/states/ike_sa_established.h +++ b/Source/charon/sa/states/ike_sa_established.h @@ -26,14 +26,14 @@ #include <sa/states/state.h> #include <sa/ike_sa.h> +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. * */ -typedef struct ike_sa_established_s ike_sa_established_t; - -struct ike_sa_established_s { +struct ike_sa_established_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/ike_sa_init_requested.c b/Source/charon/sa/states/ike_sa_init_requested.c index ea03602a9..a42b57ed4 100644 --- a/Source/charon/sa/states/ike_sa_init_requested.c +++ b/Source/charon/sa/states/ike_sa_init_requested.c @@ -29,12 +29,14 @@ #include <encoding/payloads/nonce_payload.h> #include <transforms/diffie_hellman.h> + +typedef struct private_ike_sa_init_requested_t private_ike_sa_init_requested_t; + /** * Private data of a ike_sa_init_requested_t object. * */ -typedef struct private_ike_sa_init_requested_s private_ike_sa_init_requested_t; -struct private_ike_sa_init_requested_s { +struct private_ike_sa_init_requested_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/ike_sa_init_requested.h b/Source/charon/sa/states/ike_sa_init_requested.h index 1f4f58804..0c1c01b67 100644 --- a/Source/charon/sa/states/ike_sa_init_requested.h +++ b/Source/charon/sa/states/ike_sa_init_requested.h @@ -29,13 +29,13 @@ #include <sa/states/state.h> #include <transforms/diffie_hellman.h> +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 + * @brief This class represents an IKE_SA state when requested an IKE_SA_INIT. * */ -typedef struct ike_sa_init_requested_s ike_sa_init_requested_t; - -struct ike_sa_init_requested_s { +struct ike_sa_init_requested_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/ike_sa_init_responded.c b/Source/charon/sa/states/ike_sa_init_responded.c index 885d4bea6..5c7ba0927 100644 --- a/Source/charon/sa/states/ike_sa_init_responded.c +++ b/Source/charon/sa/states/ike_sa_init_responded.c @@ -24,12 +24,14 @@ #include <utils/allocator.h> + +typedef struct private_ike_sa_init_responded_t private_ike_sa_init_responded_t; + /** * Private data of a ike_sa_init_responded_t object. * */ -typedef struct private_ike_sa_init_responded_s private_ike_sa_init_responded_t; -struct private_ike_sa_init_responded_s { +struct private_ike_sa_init_responded_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/ike_sa_init_responded.h b/Source/charon/sa/states/ike_sa_init_responded.h index e9780da22..5e871702d 100644 --- a/Source/charon/sa/states/ike_sa_init_responded.h +++ b/Source/charon/sa/states/ike_sa_init_responded.h @@ -26,13 +26,13 @@ #include <sa/ike_sa.h> #include <sa/states/state.h> +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. * */ -typedef struct ike_sa_init_responded_s ike_sa_init_responded_t; - -struct ike_sa_init_responded_s { +struct ike_sa_init_responded_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/initiator_init.c b/Source/charon/sa/states/initiator_init.c index eca25c6a3..5825eb2a0 100644 --- a/Source/charon/sa/states/initiator_init.c +++ b/Source/charon/sa/states/initiator_init.c @@ -33,12 +33,13 @@ #include <encoding/payloads/nonce_payload.h> +typedef struct private_initiator_init_t private_initiator_init_t; + /** * Private data of a initiator_init_t object. * */ -typedef struct private_initiator_init_s private_initiator_init_t; -struct private_initiator_init_s { +struct private_initiator_init_t { /** * Methods of the state_t interface. */ diff --git a/Source/charon/sa/states/initiator_init.h b/Source/charon/sa/states/initiator_init.h index 01269c0da..c61c137d1 100644 --- a/Source/charon/sa/states/initiator_init.h +++ b/Source/charon/sa/states/initiator_init.h @@ -28,14 +28,14 @@ #include <sa/states/state.h> +typedef struct initiator_init_t initiator_init_t; + /** - * @brief This class represents an IKE_SA state when initializing - * a connection as initiator + * @brief This class represents an IKE_SA state when initializing. + * a connection as initiator * */ -typedef struct initiator_init_s initiator_init_t; - -struct initiator_init_s { +struct initiator_init_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/responder_init.c b/Source/charon/sa/states/responder_init.c index c44cd4f00..885e0d7f4 100644 --- a/Source/charon/sa/states/responder_init.c +++ b/Source/charon/sa/states/responder_init.c @@ -31,12 +31,14 @@ #include <encoding/payloads/nonce_payload.h> #include <transforms/diffie_hellman.h> + +typedef struct private_responder_init_t private_responder_init_t; + /** * Private data of a responder_init_t object. * */ -typedef struct private_responder_init_s private_responder_init_t; -struct private_responder_init_s { +struct private_responder_init_t { /** * Methods of the state_t interface. */ diff --git a/Source/charon/sa/states/responder_init.h b/Source/charon/sa/states/responder_init.h index 80c2caed5..592cb6168 100644 --- a/Source/charon/sa/states/responder_init.h +++ b/Source/charon/sa/states/responder_init.h @@ -26,14 +26,15 @@ #include <sa/ike_sa.h> #include <sa/states/state.h> + +typedef struct responder_init_t responder_init_t; + /** - * @brief This class represents an IKE_SA state when initializing - * a connection as responder + * @brief This class represents an IKE_SA state when initializing. + * a connection as responder * */ -typedef struct responder_init_s responder_init_t; - -struct responder_init_s { +struct responder_init_t { /** * methods of the state_t interface */ diff --git a/Source/charon/sa/states/state.h b/Source/charon/sa/states/state.h index 305199f3f..e888eaf31 100644 --- a/Source/charon/sa/states/state.h +++ b/Source/charon/sa/states/state.h @@ -29,12 +29,12 @@ extern mapping_t ike_sa_state_m[]; +typedef enum ike_sa_state_t ike_sa_state_t; + /** * States in which a IKE_SA can actually be */ -typedef enum ike_sa_state_e ike_sa_state_t; - -enum ike_sa_state_e { +enum ike_sa_state_t { /** * IKE_SA is is not in a state as initiator @@ -75,13 +75,12 @@ enum ike_sa_state_e { */ extern mapping_t ike_sa_state_m[]; +typedef struct state_t state_t; + /** * @brief This interface represents an IKE_SA state - * */ -typedef struct state_s state_t; - -struct state_s { +struct state_t { /** * @brief Processes a incoming IKEv2-Message of type message_t diff --git a/Source/charon/threads/receiver.c b/Source/charon/threads/receiver.c index ba7e229b0..b042c402d 100644 --- a/Source/charon/threads/receiver.c +++ b/Source/charon/threads/receiver.c @@ -33,12 +33,12 @@ #include <utils/allocator.h> #include <utils/logger_manager.h> +typedef struct private_receiver_t private_receiver_t; + /** * Private data of a receiver object */ -typedef struct private_receiver_s private_receiver_t; - -struct private_receiver_s { +struct private_receiver_t { /** * Public part of a receiver object */ diff --git a/Source/charon/threads/receiver.h b/Source/charon/threads/receiver.h index 49f71be40..2f330adbf 100644 --- a/Source/charon/threads/receiver.h +++ b/Source/charon/threads/receiver.h @@ -25,12 +25,12 @@ #include <types.h> +typedef struct receiver_t receiver_t; + /** * @brief A Receiver object which receives packets on the socket and adds them to the job-queue */ -typedef struct receiver_s receiver_t; - -struct receiver_s { +struct receiver_t { /** * @brief Destroys a receiver object diff --git a/Source/charon/threads/scheduler.c b/Source/charon/threads/scheduler.c index d7f0694e7..789e39aa6 100644 --- a/Source/charon/threads/scheduler.c +++ b/Source/charon/threads/scheduler.c @@ -34,9 +34,9 @@ /** * Private data of a scheduler object */ -typedef struct private_scheduler_s private_scheduler_t; +typedef struct private_scheduler_t private_scheduler_t; -struct private_scheduler_s { +struct private_scheduler_t { /** * Public part of a scheduler object */ diff --git a/Source/charon/threads/scheduler.h b/Source/charon/threads/scheduler.h index 8aa8fbbef..1bd9e62cd 100644 --- a/Source/charon/threads/scheduler.h +++ b/Source/charon/threads/scheduler.h @@ -25,15 +25,15 @@ #include <types.h> +typedef struct scheduler_t scheduler_t; + /** * @brief The scheduler, looks for timed events in event-queue and adds them * to the job-queue. * * Starts a thread which does the work, since event-queue is blocking */ -typedef struct scheduler_s scheduler_t; - -struct scheduler_s { +struct scheduler_t { /** * @brief Destroys a scheduler object diff --git a/Source/charon/threads/sender.c b/Source/charon/threads/sender.c index d2376962f..94ebda37c 100644 --- a/Source/charon/threads/sender.c +++ b/Source/charon/threads/sender.c @@ -32,12 +32,12 @@ #include <utils/allocator.h> #include <utils/logger_manager.h> +typedef struct private_sender_t private_sender_t; + /** * Private data of a sender object */ -typedef struct private_sender_s private_sender_t; - -struct private_sender_s { +struct private_sender_t { /** * Public part of a sender object */ diff --git a/Source/charon/threads/sender.h b/Source/charon/threads/sender.h index 386e429ee..c57213ce3 100644 --- a/Source/charon/threads/sender.h +++ b/Source/charon/threads/sender.h @@ -25,12 +25,12 @@ #include <types.h> +typedef struct sender_t sender_t; + /** * @brief A Sender object which sends packets on the socket */ -typedef struct sender_s sender_t; - -struct sender_s { +struct sender_t { /** * @brief Destroys a sender object diff --git a/Source/charon/threads/thread_pool.c b/Source/charon/threads/thread_pool.c index 037222810..7cf802bda 100644 --- a/Source/charon/threads/thread_pool.c +++ b/Source/charon/threads/thread_pool.c @@ -35,12 +35,12 @@ #include <utils/allocator.h> #include <utils/logger.h> +typedef struct private_thread_pool_t private_thread_pool_t; + /** * @brief structure with private members for thread_pool_t */ -typedef struct private_thread_pool_s private_thread_pool_t; - -struct private_thread_pool_s { +struct private_thread_pool_t { /** * inclusion of public members */ diff --git a/Source/charon/threads/thread_pool.h b/Source/charon/threads/thread_pool.h index 54022e4b4..609fb04d2 100644 --- a/Source/charon/threads/thread_pool.h +++ b/Source/charon/threads/thread_pool.h @@ -27,15 +27,16 @@ #include <types.h> + +typedef struct thread_pool_t thread_pool_t; + /** * @brief A thread_pool contains a pool of threads processing the job queue. * * Current implementation uses as many threads as specified in constructor. * A more improved version would dynamically increase thread count if necessary... */ -typedef struct thread_pool_s thread_pool_t; - -struct thread_pool_s { +struct thread_pool_t { /** * @brief return currently instanciated threads * diff --git a/Source/charon/transforms/crypters/crypter.h b/Source/charon/transforms/crypters/crypter.h index 97a8ad81d..3d5a6869b 100644 --- a/Source/charon/transforms/crypters/crypter.h +++ b/Source/charon/transforms/crypters/crypter.h @@ -26,12 +26,12 @@ #include <encoding/payloads/transform_substructure.h> +typedef struct crypter_t crypter_t; + /** * Object representing a crypter object */ -typedef struct crypter_s crypter_t; - -struct crypter_s { +struct crypter_t { /** * @brief Encrypt a chunk of data and allocate space for * the encrypted value. diff --git a/Source/charon/transforms/diffie_hellman.c b/Source/charon/transforms/diffie_hellman.c index 2acd0d960..e018675fe 100644 --- a/Source/charon/transforms/diffie_hellman.c +++ b/Source/charon/transforms/diffie_hellman.c @@ -289,12 +289,12 @@ static u_int8_t group18_modulus[] = { 0x60,0xC9,0x80,0xDD,0x98,0xED,0xD3,0xDF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, }; +typedef struct modulus_info_entry_t modulus_info_entry_t; + /** * Entry of the modulus list */ -typedef struct modulus_info_entry_s modulus_info_entry_t; - -struct modulus_info_entry_s{ +struct modulus_info_entry_t { /** * Group number as it is defined in transform_substructure.h */ @@ -328,13 +328,13 @@ static modulus_info_entry_t modulus_info_entries[] = { {MODP_8192_BIT,group18_modulus,sizeof(group18_modulus),2}, }; +typedef struct private_diffie_hellman_t private_diffie_hellman_t; + /** * Private data of an diffie_hellman_t object. * */ -typedef struct private_diffie_hellman_s private_diffie_hellman_t; - -struct private_diffie_hellman_s { +struct private_diffie_hellman_t { /** * public diffie_hellman_t interface */ diff --git a/Source/charon/transforms/diffie_hellman.h b/Source/charon/transforms/diffie_hellman.h index e775cbb15..ab1672d32 100644 --- a/Source/charon/transforms/diffie_hellman.h +++ b/Source/charon/transforms/diffie_hellman.h @@ -26,13 +26,13 @@ #include <types.h> #include <encoding/payloads/transform_substructure.h> +typedef struct diffie_hellman_t diffie_hellman_t; + /** * Object representing a diffie hellman exchange * */ -typedef struct diffie_hellman_s diffie_hellman_t; - -struct diffie_hellman_s { +struct diffie_hellman_t { /** * @brief Returns the shared secret of this diffie hellman exchange diff --git a/Source/charon/transforms/hashers/hasher.h b/Source/charon/transforms/hashers/hasher.h index a20ec6813..8b4699a3e 100644 --- a/Source/charon/transforms/hashers/hasher.h +++ b/Source/charon/transforms/hashers/hasher.h @@ -26,23 +26,23 @@ #include <types.h> +typedef enum hash_algorithm_t hash_algorithm_t; + /** * algorithms to use for hashing */ -typedef enum hash_algorithm_e hash_algorithm_t; - -enum hash_algorithm_e { +enum hash_algorithm_t { HASH_SHA1, HASH_MD5 }; +typedef struct hasher_t hasher_t; + /** * Object representing a hasher */ -typedef struct hasher_s hasher_t; - -struct hasher_s { +struct hasher_t { /** * @brief hash data and write it in the buffer * diff --git a/Source/charon/transforms/hashers/hasher_md5.c b/Source/charon/transforms/hashers/hasher_md5.c index f671bef6c..bfdd96785 100644 --- a/Source/charon/transforms/hashers/hasher_md5.c +++ b/Source/charon/transforms/hashers/hasher_md5.c @@ -98,12 +98,12 @@ Rotation is separate from addition to prevent recomputation. +typedef struct private_hasher_md5_t private_hasher_md5_t; + /** * private data structure with hasing context */ -typedef struct private_hasher_md5_s private_hasher_md5_t; - -struct private_hasher_md5_s { +struct private_hasher_md5_t { /** * public interface for this hasher */ diff --git a/Source/charon/transforms/hashers/hasher_md5.h b/Source/charon/transforms/hashers/hasher_md5.h index cc7c6c32a..d7e9124ee 100644 --- a/Source/charon/transforms/hashers/hasher_md5.h +++ b/Source/charon/transforms/hashers/hasher_md5.h @@ -27,13 +27,13 @@ #include <transforms/hashers/hasher.h> +typedef struct hasher_md5_t hasher_md5_t; + /** * Object representing the md5 hasher * */ -typedef struct hasher_md5_s hasher_md5_t; - -struct hasher_md5_s { +struct hasher_md5_t { /** * generic hasher_t interface for this hasher diff --git a/Source/charon/transforms/hashers/hasher_sha1.c b/Source/charon/transforms/hashers/hasher_sha1.c index b8a7d14cc..75057457a 100644 --- a/Source/charon/transforms/hashers/hasher_sha1.c +++ b/Source/charon/transforms/hashers/hasher_sha1.c @@ -53,12 +53,12 @@ #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); +typedef struct private_hasher_sha1_t private_hasher_sha1_t; + /** * private data structure with hasing context */ -typedef struct private_hasher_sha1_s private_hasher_sha1_t; - -struct private_hasher_sha1_s { +struct private_hasher_sha1_t { /** * public interface for this hasher */ diff --git a/Source/charon/transforms/hashers/hasher_sha1.h b/Source/charon/transforms/hashers/hasher_sha1.h index 76aa9049c..1f96d5d72 100644 --- a/Source/charon/transforms/hashers/hasher_sha1.h +++ b/Source/charon/transforms/hashers/hasher_sha1.h @@ -27,13 +27,13 @@ #include <transforms/hashers/hasher.h> +typedef struct hasher_sha1_t hasher_sha1_t; + /** * Object representing the sha1 hasher * */ -typedef struct hasher_sha1_s hasher_sha1_t; - -struct hasher_sha1_s { +struct hasher_sha1_t { /** * generic hasher_t interface for this hasher diff --git a/Source/charon/transforms/hmac.c b/Source/charon/transforms/hmac.c index 760d56218..589716f9d 100644 --- a/Source/charon/transforms/hmac.c +++ b/Source/charon/transforms/hmac.c @@ -1,9 +1,7 @@ /** * @file hmac.c * - * @brief Implementation of message authentication - * using cryptographic hash functions (HMAC). See RFC2104. - * + * @brief Implementation of hmac_t */ /* @@ -26,13 +24,13 @@ #include <utils/allocator.h> +typedef struct private_hmac_t private_hmac_t; + /** * Private data of an hmac_t object. * */ -typedef struct private_hmac_s private_hmac_t; - -struct private_hmac_s { +struct private_hmac_t { /** * public hmac_t interface */ diff --git a/Source/charon/transforms/hmac.h b/Source/charon/transforms/hmac.h index 6de424783..384f47dc9 100644 --- a/Source/charon/transforms/hmac.h +++ b/Source/charon/transforms/hmac.h @@ -1,9 +1,7 @@ /** * @file hmac.h * - * @brief Implementation of message authentication - * using cryptographic hash functions (HMAC). See RFC2104. - * + * @brief Interface of hmac_t. */ /* @@ -24,16 +22,25 @@ #ifndef HMAC_H_ #define HMAC_H_ - #include <transforms/hashers/hasher.h> +#include <definitions.h> + + +typedef struct hmac_t hmac_t; /** - * Object representing a hmac + * @brief Message authentication based using hash functions. + * + * This class implements the message authenticaion algorithm + * described in RFC2104. It uses a hash function, wich must + * be implemented as a hasher_t class. + * + * @see hasher_t, prf_hmac_t + * + * @ingroup transforms */ -typedef struct hmac_s hmac_t; - -struct hmac_s { +struct hmac_t { /** * @brief Generate message authentication code. * @@ -98,13 +105,19 @@ struct hmac_s { }; /** - * Creates a new hmac_t object + * @brief Creates a new hmac_t object. + * + * Creates a new hmac_t object using sing hash_algorithm to + * create a hasher_t internally. * * @param hash_algorithm hash algorithm to use * @return * - hmac_t if successfully * - NULL if out of ressources or hash not supported + * + * @ingroup transforms */ hmac_t *hmac_create(hash_algorithm_t hash_algorithm); + #endif /*HMAC_H_*/ diff --git a/Source/charon/transforms/prf_plus.c b/Source/charon/transforms/prf_plus.c index 4b1185dd8..2c6e16b00 100644 --- a/Source/charon/transforms/prf_plus.c +++ b/Source/charon/transforms/prf_plus.c @@ -26,13 +26,13 @@ #include <utils/allocator.h> #include <definitions.h> +typedef struct private_prf_plus_t private_prf_plus_t; + /** * Private data of an prf_plus_t object. * */ -typedef struct private_prf_plus_s private_prf_plus_t; - -struct private_prf_plus_s { +struct private_prf_plus_t { /** * public prf_plus_t interface */ diff --git a/Source/charon/transforms/prf_plus.h b/Source/charon/transforms/prf_plus.h index 51af4d36c..fb0e4cac0 100644 --- a/Source/charon/transforms/prf_plus.h +++ b/Source/charon/transforms/prf_plus.h @@ -27,12 +27,12 @@ #include <transforms/prfs/prf.h> +typedef struct prf_plus_t prf_plus_t; + /** * Object representing a prf_plus */ -typedef struct prf_plus_s prf_plus_t; - -struct prf_plus_s { +struct prf_plus_t { /** * @brief Get pseudo random bytes. * diff --git a/Source/charon/transforms/prfs/prf.h b/Source/charon/transforms/prfs/prf.h index da624a0f0..2b6aab46e 100644 --- a/Source/charon/transforms/prfs/prf.h +++ b/Source/charon/transforms/prfs/prf.h @@ -26,12 +26,14 @@ #include <encoding/payloads/transform_substructure.h> +typedef struct prf_t prf_t; + /** * Object representing a diffie hellman exchange + * + * @ingroup prfs */ -typedef struct prf_s prf_t; - -struct prf_s { +struct prf_t { /** * @brief generates pseudo random bytes and writes them * in the buffer @@ -89,6 +91,8 @@ struct prf_s { * @return * - prf_t if successfully * - NULL if out of ressources or prf not supported + * + * @ingroup prfs */ prf_t *prf_create(pseudo_random_function_t pseudo_random_function); diff --git a/Source/charon/transforms/prfs/prf_hmac.c b/Source/charon/transforms/prfs/prf_hmac.c index 9668e1b41..fdcce4af2 100644 --- a/Source/charon/transforms/prfs/prf_hmac.c +++ b/Source/charon/transforms/prfs/prf_hmac.c @@ -26,9 +26,9 @@ #include <utils/allocator.h> #include <transforms/hmac.h> -typedef struct private_prf_hmac_s private_prf_hmac_t; +typedef struct private_prf_hmac_t private_prf_hmac_t; -struct private_prf_hmac_s { +struct private_prf_hmac_t { /** * public interface for this prf */ diff --git a/Source/charon/transforms/prfs/prf_hmac.h b/Source/charon/transforms/prfs/prf_hmac.h index 22e993bee..427cdd4d7 100644 --- a/Source/charon/transforms/prfs/prf_hmac.h +++ b/Source/charon/transforms/prfs/prf_hmac.h @@ -29,13 +29,13 @@ #include <types.h> #include <transforms/hashers/hasher.h> +typedef struct prf_hmac_t prf_hmac_t; + /** * Object representing a prf using HMAC * */ -typedef struct prf_hmac_s prf_hmac_t; - -struct prf_hmac_s { +struct prf_hmac_t { /** * generic prf_t interface for this prf diff --git a/Source/charon/transforms/signers/signer.h b/Source/charon/transforms/signers/signer.h index d179b1317..b0a107e2f 100644 --- a/Source/charon/transforms/signers/signer.h +++ b/Source/charon/transforms/signers/signer.h @@ -26,12 +26,12 @@ #include <encoding/payloads/transform_substructure.h> +typedef struct signer_t signer_t; + /** * Object representing a diffie hellman exchange */ -typedef struct signer_s signer_t; - -struct signer_s { +struct signer_t { /** * @brief generates pseudo random bytes and writes them * in the buffer diff --git a/Source/charon/types.h b/Source/charon/types.h index b3021dd21..5e7b6bba3 100644 --- a/Source/charon/types.h +++ b/Source/charon/types.h @@ -30,7 +30,12 @@ #include <definitions.h> -typedef enum status_e { +typedef enum status_t status_t; + +/** + * return status for function calls + */ +enum status_t { SUCCESS, FAILED, OUT_OF_RES, @@ -41,7 +46,7 @@ typedef enum status_e { PARSE_ERROR, VERIFY_ERROR, INVALID_STATE -} status_t; +}; extern mapping_t status_m[]; @@ -52,15 +57,20 @@ typedef struct timespec timespec_t; typedef struct sockaddr sockaddr_t; +typedef struct chunk_t chunk_t; + /** * General purpose pointer/length abstraction */ -typedef struct chunk_s chunk_t; -struct chunk_s { +struct chunk_t { u_char *ptr; size_t len; }; +/** + * {NULL, 0}-chunk, handy for initialization + * of chunks. + */ extern chunk_t CHUNK_INITIALIZER; /** diff --git a/Source/charon/utils/allocator.c b/Source/charon/utils/allocator.c index dcb4e4231..a56369f95 100644 --- a/Source/charon/utils/allocator.c +++ b/Source/charon/utils/allocator.c @@ -32,14 +32,14 @@ #ifdef LEAK_DETECTIVE +typedef union memory_hdr_t memory_hdr_t; + /** * Header of each allocated memory area * * Used to detect memory leaks */ -typedef union memory_hdr_u memory_hdr_t; - -union memory_hdr_u { +union memory_hdr_t { struct { /** * Filename withing memory was allocated @@ -69,9 +69,9 @@ union memory_hdr_u { * * Contains private variables of allocator_t object. */ -typedef struct private_allocator_s private_allocator_t; +typedef struct private_allocator_t private_allocator_t; -struct private_allocator_s +struct private_allocator_t { /** * Public part of an allocator_t object. diff --git a/Source/charon/utils/allocator.h b/Source/charon/utils/allocator.h index e3d81b349..e262372a4 100644 --- a/Source/charon/utils/allocator.h +++ b/Source/charon/utils/allocator.h @@ -53,13 +53,13 @@ #ifdef LEAK_DETECTIVE + typedef struct allocator_t allocator_t; + /** - * @brief Allocater object use to detect memory leaks. - * + *@brief Allocater object use to detect memory leaks. + * */ - typedef struct allocator_s allocator_t; - - struct allocator_s { + struct allocator_t { /** * Allocates memory with LEAK_DETECTION and diff --git a/Source/charon/utils/gmp_helper.c b/Source/charon/utils/gmp_helper.c index 4e4a35c0b..745d69e0c 100644 --- a/Source/charon/utils/gmp_helper.c +++ b/Source/charon/utils/gmp_helper.c @@ -33,13 +33,12 @@ */ #define PRIMECHECK_ROUNDS 30 +typedef struct private_gmp_helper_t private_gmp_helper_t; + /** * Private data of an gmp_helper_t object. - * */ -typedef struct private_gmp_helper_s private_gmp_helper_t; - -struct private_gmp_helper_s { +struct private_gmp_helper_t { /** * public gmp_helper_t interface */ diff --git a/Source/charon/utils/gmp_helper.h b/Source/charon/utils/gmp_helper.h index 015f7492e..08a51dbb8 100644 --- a/Source/charon/utils/gmp_helper.h +++ b/Source/charon/utils/gmp_helper.h @@ -30,13 +30,13 @@ #include <types.h> +typedef struct gmp_helper_t gmp_helper_t; + /** - * Class with helper functions to manipulate gmp values + * @brief Class with helper functions to manipulate gmp values. * */ -typedef struct gmp_helper_s gmp_helper_t; - -struct gmp_helper_s { +struct gmp_helper_t { /** * @brief initialize an mpz_t to a random prime of specified size diff --git a/Source/charon/utils/linked_list.c b/Source/charon/utils/linked_list.c index 42dcf568d..83e037053 100644 --- a/Source/charon/utils/linked_list.c +++ b/Source/charon/utils/linked_list.c @@ -27,15 +27,14 @@ #include <utils/allocator.h> -typedef struct linked_list_element_s linked_list_element_t; - +typedef struct linked_list_element_t linked_list_element_t; /** * @brief Element of the linked_list. * * This element holds a pointer to the value of the list item itself. */ -struct linked_list_element_s{ +struct linked_list_element_t { /** * value of a list item */ @@ -106,9 +105,9 @@ linked_list_element_t *linked_list_element_create(void *value) * Private variables and functions of linked list * */ -typedef struct private_linked_list_s private_linked_list_t; +typedef struct private_linked_list_t private_linked_list_t; -struct private_linked_list_s{ +struct private_linked_list_t { /** * Public part of linked list */ @@ -136,9 +135,9 @@ struct private_linked_list_s{ * Private variables and functions of linked list iterator * */ -typedef struct private_linked_list_iterator_s private_linked_list_iterator_t; +typedef struct private_linked_list_iterator_t private_linked_list_iterator_t; -struct private_linked_list_iterator_s{ +struct private_linked_list_iterator_t { /** * Public part of linked list iterator */ diff --git a/Source/charon/utils/linked_list.h b/Source/charon/utils/linked_list.h index eaea27f7c..f5a87cd14 100644 --- a/Source/charon/utils/linked_list.h +++ b/Source/charon/utils/linked_list.h @@ -25,16 +25,16 @@ #include <types.h> +typedef struct linked_list_iterator_t linked_list_iterator_t; + /** - * @brief Iterator for a linked list - * + * @brief Iterator for a linked list. + * * This element holds a pointer to the current element in the linked list - * + * * @warning the iterator is NOT thread-save */ -typedef struct linked_list_iterator_s linked_list_iterator_t; - -struct linked_list_iterator_s { +struct linked_list_iterator_t { /** * @brief returns TRUE if more elements are available @@ -92,8 +92,11 @@ struct linked_list_iterator_s { status_t (*destroy) (linked_list_iterator_t *this); }; +typedef struct linked_list_t linked_list_t; + + /** - * @brief Double Linked List (named only as linked list) + * @brief Double Linked List (named only as linked list). * * @warning Access to an object of this type is not thread-save * @@ -101,10 +104,7 @@ struct linked_list_iterator_s { * @see event_queue_t * @see send_queue_t */ -typedef struct linked_list_s linked_list_t; - - -struct linked_list_s { +struct linked_list_t { /** * @brief gets the count of items in the list diff --git a/Source/charon/utils/logger.c b/Source/charon/utils/logger.c index f06a57159..69460d23e 100644 --- a/Source/charon/utils/logger.c +++ b/Source/charon/utils/logger.c @@ -37,11 +37,12 @@ */ #define MAX_LOG 8192 +typedef struct private_logger_t private_logger_t; + /** * @brief The logger object. */ -typedef struct private_logger_s private_logger_t; -struct private_logger_s { +struct private_logger_t { /** * Public data */ diff --git a/Source/charon/utils/logger.h b/Source/charon/utils/logger.h index 3c4b3456e..e3fd5534e 100644 --- a/Source/charon/utils/logger.h +++ b/Source/charon/utils/logger.h @@ -27,6 +27,8 @@ #include <types.h> +typedef enum logger_level_t logger_level_t; + /** * @brief Log Levels supported by the logger object * @@ -37,8 +39,7 @@ * as CONTROL|MORE fore a detailed cotrol level, or * use RAW| to see all raw data dumps (except private) */ -typedef enum logger_level_e logger_level_t; -enum logger_level_e { +enum logger_level_t { /** * control flow */ @@ -75,11 +76,12 @@ enum logger_level_e { FULL = ALL + CONTROL + ERROR + RAW + PRIVATE }; +typedef struct logger_t logger_t; + /** * @brief The logger object */ -typedef struct logger_s logger_t; -struct logger_s { +struct logger_t { /** * @brief Log an entry, using printf()-like params. diff --git a/Source/charon/utils/logger_manager.c b/Source/charon/utils/logger_manager.c index aa2fdf2c8..0bd7e18d3 100644 --- a/Source/charon/utils/logger_manager.c +++ b/Source/charon/utils/logger_manager.c @@ -49,8 +49,9 @@ mapping_t logger_context_t_mappings[] = { */ #define MAX_LOGGER_NAME 45 -typedef struct private_logger_manager_s private_logger_manager_t; -struct private_logger_manager_s { +typedef struct private_logger_manager_t private_logger_manager_t; + +struct private_logger_manager_t { /** * Public data. */ @@ -91,9 +92,9 @@ struct private_logger_manager_s { /** * Entry in the logger_levels linked list */ -typedef struct logger_levels_entry_s logger_levels_entry_t; +typedef struct logger_levels_entry_t logger_levels_entry_t; -struct logger_levels_entry_s{ +struct logger_levels_entry_t { logger_context_t context; logger_level_t level; }; @@ -101,9 +102,9 @@ struct logger_levels_entry_s{ /** * Entry in the loggers linked list */ -typedef struct loggers_entry_s loggers_entry_t; +typedef struct loggers_entry_t loggers_entry_t; -struct loggers_entry_s{ +struct loggers_entry_t { logger_context_t context; logger_t *logger; }; diff --git a/Source/charon/utils/logger_manager.h b/Source/charon/utils/logger_manager.h index 1553963e6..de37e1e0f 100644 --- a/Source/charon/utils/logger_manager.h +++ b/Source/charon/utils/logger_manager.h @@ -27,12 +27,12 @@ #include <utils/logger.h> +typedef enum logger_context_t logger_context_t; + /** * @brief Context of a specific logger */ -typedef enum logger_context_e logger_context_t; - -enum logger_context_e{ +enum logger_context_t { PARSER, GENERATOR, IKE_SA, @@ -47,14 +47,14 @@ enum logger_context_e{ TESTER, DAEMON, CONFIGURATION_MANAGER, - }; +}; + +typedef struct logger_manager_t logger_manager_t; /** * @brief The logger_manager_t object */ -typedef struct logger_manager_s logger_manager_t; - -struct logger_manager_s { +struct logger_manager_t { /** * @brief Gets a logger_t object for a specific logger context. diff --git a/Source/charon/utils/randomizer.c b/Source/charon/utils/randomizer.c index e59eeda91..f15507a21 100644 --- a/Source/charon/utils/randomizer.c +++ b/Source/charon/utils/randomizer.c @@ -40,9 +40,9 @@ */ #define DEFAULT_PSEUDO_RANDOM_DEVICE "/dev/urandom" -typedef struct private_randomizer_s private_randomizer_t; +typedef struct private_randomizer_t private_randomizer_t; -struct private_randomizer_s { +struct private_randomizer_t { /** * public interface */ diff --git a/Source/charon/utils/randomizer.h b/Source/charon/utils/randomizer.h index 4531f03cc..b9f8890c0 100644 --- a/Source/charon/utils/randomizer.h +++ b/Source/charon/utils/randomizer.h @@ -25,14 +25,14 @@ #include <types.h> +typedef struct randomizer_t randomizer_t; + /** - * Object representing an randomizer + * @brief Object representing an randomizer * * This class is thread save as file system read calls are thread save... */ -typedef struct randomizer_s randomizer_t; - -struct randomizer_s { +struct randomizer_t { /** * @brief Reads a specific number of bytes from random device. diff --git a/Source/charon/utils/tester.c b/Source/charon/utils/tester.c index 074224076..77e9c7728 100644 --- a/Source/charon/utils/tester.c +++ b/Source/charon/utils/tester.c @@ -32,13 +32,14 @@ #include <utils/linked_list.h> #include <queues/job_queue.h> + +typedef struct private_tester_t private_tester_t; + /** - * @brief Private Variables and Functions of tester class + * @brief Private Variables and Functions of tester class. * */ -typedef struct private_tester_s private_tester_t; - -struct private_tester_s { +struct private_tester_t { tester_t public; diff --git a/Source/charon/utils/tester.h b/Source/charon/utils/tester.h index 0ecd8ba54..222b0d43a 100644 --- a/Source/charon/utils/tester.h +++ b/Source/charon/utils/tester.h @@ -29,22 +29,22 @@ -/** - * @brief Specifies a test - */ -typedef struct test_s test_t; +typedef struct test_t test_t; + +typedef struct tester_t tester_t; /** - * @brief A tester object to perform tests with + * @brief Specifies a test */ -typedef struct tester_s tester_t; - -struct test_s{ +struct test_t { void (*test_function) (tester_t * tester); char * test_name; }; -struct tester_s { +/** + * @brief A tester object to perform tests with + */ +struct tester_t { /** * @brief Tests all testcases in array tests with specific tester object |