- typedefs changed
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#define NUMBER_OF_WORKING_THREADS 4
|
#define NUMBER_OF_WORKING_THREADS 4
|
||||||
|
|
||||||
#define IKEV2_UDP_PORT 500
|
#define IKEV2_UDP_PORT 4500
|
||||||
|
|
||||||
|
|
||||||
#endif /*DAEMON_H_*/
|
#endif /*DAEMON_H_*/
|
||||||
|
|||||||
@@ -59,6 +59,22 @@
|
|||||||
#error "BYTE_ORDER must be defined"
|
#error "BYTE_ORDER must be defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Doxygen namespace support
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup transforms
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup prfs
|
||||||
|
*
|
||||||
|
* @ingroup transforms
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro gives back larger of two values
|
* macro gives back larger of two values
|
||||||
*/
|
*/
|
||||||
@@ -76,11 +92,12 @@
|
|||||||
*/
|
*/
|
||||||
#define MAPPING_END (-1)
|
#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_t
|
||||||
struct mapping_s
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* enumeration value
|
* enumeration value
|
||||||
|
|||||||
@@ -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}
|
{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
|
* Entry for a payload in the internal used linked list
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct payload_entry_s payload_entry_t;
|
struct payload_entry_t {
|
||||||
|
|
||||||
struct payload_entry_s {
|
|
||||||
/**
|
/**
|
||||||
* Type of payload
|
* 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
|
* Private data of an message_t object
|
||||||
*/
|
*/
|
||||||
typedef struct private_message_s private_message_t;
|
struct private_message_t {
|
||||||
|
|
||||||
struct private_message_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public part of a message_t object
|
* Public part of a message_t object
|
||||||
|
|||||||
@@ -333,9 +333,9 @@ extern mapping_t encoding_type_m[];
|
|||||||
*
|
*
|
||||||
* This rules are used by parser and generator.
|
* 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
|
* Encoding type
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,13 +41,13 @@
|
|||||||
*/
|
*/
|
||||||
#define NONCE_SIZE 16
|
#define NONCE_SIZE 16
|
||||||
|
|
||||||
|
typedef struct ike_sa_t ike_sa_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class is used to represent an IKE_SA
|
* @brief This class is used to represent an IKE_SA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct ike_sa_s ike_sa_t;
|
struct ike_sa_t {
|
||||||
|
|
||||||
struct ike_sa_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Processes a incoming IKEv2-Message of type message_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);
|
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
|
* Protected data of an ike_sa_t object
|
||||||
*/
|
*/
|
||||||
typedef struct protected_ike_sa_s protected_ike_sa_t;
|
struct protected_ike_sa_t {
|
||||||
|
|
||||||
struct protected_ike_sa_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public part of a ike_sa_t object
|
* Public part of a ike_sa_t object
|
||||||
|
|||||||
@@ -28,12 +28,12 @@
|
|||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <utils/allocator.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
|
* 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_t {
|
||||||
|
|
||||||
struct private_ike_sa_id_s {
|
|
||||||
/**
|
/**
|
||||||
* Public part of a ike_sa_id object
|
* Public part of a ike_sa_id object
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
typedef struct ike_sa_id_t ike_sa_id_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class is used to identify an IKE_SA.
|
* @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
|
* Additionaly it contains the role of the actual running IKEv2-Daemon
|
||||||
* for the specific IKE_SA.
|
* for the specific IKE_SA.
|
||||||
*/
|
*/
|
||||||
typedef struct ike_sa_id_s ike_sa_id_t;
|
struct ike_sa_id_t {
|
||||||
|
|
||||||
struct ike_sa_id_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the SPI of the responder.
|
* @brief Sets the SPI of the responder.
|
||||||
|
|||||||
@@ -32,11 +32,12 @@
|
|||||||
#include <utils/logger_manager.h>
|
#include <utils/logger_manager.h>
|
||||||
#include <utils/linked_list.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.
|
* @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_t {
|
||||||
struct ike_sa_entry_s {
|
|
||||||
/**
|
/**
|
||||||
* destructor, also destroys ike_sa
|
* 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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct private_ike_sa_manager_t private_ike_sa_manager_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional private members to 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_t {
|
||||||
struct private_ike_sa_manager_s {
|
|
||||||
/**
|
/**
|
||||||
* Public members
|
* Public members
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
#include <sa/ike_sa.h>
|
#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 ;-).
|
||||||
*
|
*
|
||||||
@@ -38,8 +40,7 @@
|
|||||||
* This could be by comparing thread-ids via pthread_self()...
|
* This could be by comparing thread-ids via pthread_self()...
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct ike_sa_manager_s ike_sa_manager_t;
|
struct ike_sa_manager_t {
|
||||||
struct ike_sa_manager_s {
|
|
||||||
/**
|
/**
|
||||||
* @brief Checkout an IKE_SA, create it when necesarry
|
* @brief Checkout an IKE_SA, create it when necesarry
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -24,12 +24,14 @@
|
|||||||
|
|
||||||
#include <utils/allocator.h>
|
#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.
|
* 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_t {
|
||||||
struct private_ike_auth_requested_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,13 +26,14 @@
|
|||||||
#include <sa/states/state.h>
|
#include <sa/states/state.h>
|
||||||
#include <sa/ike_sa.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.
|
* @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_t {
|
||||||
|
|
||||||
struct ike_auth_requested_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,12 +24,14 @@
|
|||||||
|
|
||||||
#include <utils/allocator.h>
|
#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.
|
* 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_t {
|
||||||
struct private_ike_sa_established_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,14 +26,14 @@
|
|||||||
#include <sa/states/state.h>
|
#include <sa/states/state.h>
|
||||||
#include <sa/ike_sa.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.
|
* IKE_SA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct ike_sa_established_s ike_sa_established_t;
|
struct ike_sa_established_t {
|
||||||
|
|
||||||
struct ike_sa_established_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,12 +29,14 @@
|
|||||||
#include <encoding/payloads/nonce_payload.h>
|
#include <encoding/payloads/nonce_payload.h>
|
||||||
#include <transforms/diffie_hellman.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.
|
* 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_t {
|
||||||
struct private_ike_sa_init_requested_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,13 +29,13 @@
|
|||||||
#include <sa/states/state.h>
|
#include <sa/states/state.h>
|
||||||
#include <transforms/diffie_hellman.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_t {
|
||||||
|
|
||||||
struct ike_sa_init_requested_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,12 +24,14 @@
|
|||||||
|
|
||||||
#include <utils/allocator.h>
|
#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.
|
* 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_t {
|
||||||
struct private_ike_sa_init_responded_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,13 +26,13 @@
|
|||||||
#include <sa/ike_sa.h>
|
#include <sa/ike_sa.h>
|
||||||
#include <sa/states/state.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_t {
|
||||||
|
|
||||||
struct ike_sa_init_responded_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -33,12 +33,13 @@
|
|||||||
#include <encoding/payloads/nonce_payload.h>
|
#include <encoding/payloads/nonce_payload.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct private_initiator_init_t private_initiator_init_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data of a initiator_init_t object.
|
* Private data of a initiator_init_t object.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct private_initiator_init_s private_initiator_init_t;
|
struct private_initiator_init_t {
|
||||||
struct private_initiator_init_s {
|
|
||||||
/**
|
/**
|
||||||
* Methods of the state_t interface.
|
* Methods of the state_t interface.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -28,14 +28,14 @@
|
|||||||
#include <sa/states/state.h>
|
#include <sa/states/state.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct initiator_init_t initiator_init_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class represents an IKE_SA state when initializing
|
* @brief This class represents an IKE_SA state when initializing.
|
||||||
* a connection as initiator
|
* a connection as initiator
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct initiator_init_s initiator_init_t;
|
struct initiator_init_t {
|
||||||
|
|
||||||
struct initiator_init_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,12 +31,14 @@
|
|||||||
#include <encoding/payloads/nonce_payload.h>
|
#include <encoding/payloads/nonce_payload.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <transforms/diffie_hellman.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct private_responder_init_t private_responder_init_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data of a responder_init_t object.
|
* Private data of a responder_init_t object.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct private_responder_init_s private_responder_init_t;
|
struct private_responder_init_t {
|
||||||
struct private_responder_init_s {
|
|
||||||
/**
|
/**
|
||||||
* Methods of the state_t interface.
|
* Methods of the state_t interface.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,14 +26,15 @@
|
|||||||
#include <sa/ike_sa.h>
|
#include <sa/ike_sa.h>
|
||||||
#include <sa/states/state.h>
|
#include <sa/states/state.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct responder_init_t responder_init_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class represents an IKE_SA state when initializing
|
* @brief This class represents an IKE_SA state when initializing.
|
||||||
* a connection as responder
|
* a connection as responder
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct responder_init_s responder_init_t;
|
struct responder_init_t {
|
||||||
|
|
||||||
struct responder_init_s {
|
|
||||||
/**
|
/**
|
||||||
* methods of the state_t interface
|
* methods of the state_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,12 +29,12 @@
|
|||||||
|
|
||||||
extern mapping_t ike_sa_state_m[];
|
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
|
* States in which a IKE_SA can actually be
|
||||||
*/
|
*/
|
||||||
typedef enum ike_sa_state_e ike_sa_state_t;
|
enum ike_sa_state_t {
|
||||||
|
|
||||||
enum ike_sa_state_e {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IKE_SA is is not in a state as initiator
|
* 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[];
|
extern mapping_t ike_sa_state_m[];
|
||||||
|
|
||||||
|
typedef struct state_t state_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This interface represents an IKE_SA state
|
* @brief This interface represents an IKE_SA state
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef struct state_s state_t;
|
struct state_t {
|
||||||
|
|
||||||
struct state_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Processes a incoming IKEv2-Message of type message_t
|
* @brief Processes a incoming IKEv2-Message of type message_t
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <utils/logger_manager.h>
|
#include <utils/logger_manager.h>
|
||||||
|
|
||||||
|
typedef struct private_receiver_t private_receiver_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data of a receiver object
|
* Private data of a receiver object
|
||||||
*/
|
*/
|
||||||
typedef struct private_receiver_s private_receiver_t;
|
struct private_receiver_t {
|
||||||
|
|
||||||
struct private_receiver_s {
|
|
||||||
/**
|
/**
|
||||||
* Public part of a receiver object
|
* Public part of a receiver object
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#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
|
* @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_t {
|
||||||
|
|
||||||
struct receiver_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroys a receiver object
|
* @brief Destroys a receiver object
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
/**
|
/**
|
||||||
* Private data of a scheduler object
|
* 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
|
* Public part of a scheduler object
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,15 +25,15 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
|
typedef struct scheduler_t scheduler_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The scheduler, looks for timed events in event-queue and adds them
|
* @brief The scheduler, looks for timed events in event-queue and adds them
|
||||||
* to the job-queue.
|
* to the job-queue.
|
||||||
*
|
*
|
||||||
* Starts a thread which does the work, since event-queue is blocking
|
* Starts a thread which does the work, since event-queue is blocking
|
||||||
*/
|
*/
|
||||||
typedef struct scheduler_s scheduler_t;
|
struct scheduler_t {
|
||||||
|
|
||||||
struct scheduler_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroys a scheduler object
|
* @brief Destroys a scheduler object
|
||||||
|
|||||||
@@ -32,12 +32,12 @@
|
|||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <utils/logger_manager.h>
|
#include <utils/logger_manager.h>
|
||||||
|
|
||||||
|
typedef struct private_sender_t private_sender_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data of a sender object
|
* Private data of a sender object
|
||||||
*/
|
*/
|
||||||
typedef struct private_sender_s private_sender_t;
|
struct private_sender_t {
|
||||||
|
|
||||||
struct private_sender_s {
|
|
||||||
/**
|
/**
|
||||||
* Public part of a sender object
|
* Public part of a sender object
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
|
typedef struct sender_t sender_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A Sender object which sends packets on the socket
|
* @brief A Sender object which sends packets on the socket
|
||||||
*/
|
*/
|
||||||
typedef struct sender_s sender_t;
|
struct sender_t {
|
||||||
|
|
||||||
struct sender_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroys a sender object
|
* @brief Destroys a sender object
|
||||||
|
|||||||
@@ -35,12 +35,12 @@
|
|||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <utils/logger.h>
|
#include <utils/logger.h>
|
||||||
|
|
||||||
|
typedef struct private_thread_pool_t private_thread_pool_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief structure with private members for 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_t {
|
||||||
|
|
||||||
struct private_thread_pool_s {
|
|
||||||
/**
|
/**
|
||||||
* inclusion of public members
|
* inclusion of public members
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,15 +27,16 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct thread_pool_t thread_pool_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A thread_pool contains a pool of threads processing the job queue.
|
* @brief A thread_pool contains a pool of threads processing the job queue.
|
||||||
*
|
*
|
||||||
* Current implementation uses as many threads as specified in constructor.
|
* Current implementation uses as many threads as specified in constructor.
|
||||||
* A more improved version would dynamically increase thread count if necessary...
|
* A more improved version would dynamically increase thread count if necessary...
|
||||||
*/
|
*/
|
||||||
typedef struct thread_pool_s thread_pool_t;
|
struct thread_pool_t {
|
||||||
|
|
||||||
struct thread_pool_s {
|
|
||||||
/**
|
/**
|
||||||
* @brief return currently instanciated threads
|
* @brief return currently instanciated threads
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,12 +26,12 @@
|
|||||||
#include <encoding/payloads/transform_substructure.h>
|
#include <encoding/payloads/transform_substructure.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct crypter_t crypter_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing a crypter object
|
* Object representing a crypter object
|
||||||
*/
|
*/
|
||||||
typedef struct crypter_s crypter_t;
|
struct crypter_t {
|
||||||
|
|
||||||
struct crypter_s {
|
|
||||||
/**
|
/**
|
||||||
* @brief Encrypt a chunk of data and allocate space for
|
* @brief Encrypt a chunk of data and allocate space for
|
||||||
* the encrypted value.
|
* the encrypted value.
|
||||||
|
|||||||
@@ -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,
|
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
|
* Entry of the modulus list
|
||||||
*/
|
*/
|
||||||
typedef struct modulus_info_entry_s modulus_info_entry_t;
|
struct modulus_info_entry_t {
|
||||||
|
|
||||||
struct modulus_info_entry_s{
|
|
||||||
/**
|
/**
|
||||||
* Group number as it is defined in transform_substructure.h
|
* 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},
|
{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.
|
* Private data of an diffie_hellman_t object.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct private_diffie_hellman_s private_diffie_hellman_t;
|
struct private_diffie_hellman_t {
|
||||||
|
|
||||||
struct private_diffie_hellman_s {
|
|
||||||
/**
|
/**
|
||||||
* public diffie_hellman_t interface
|
* public diffie_hellman_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,13 +26,13 @@
|
|||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <encoding/payloads/transform_substructure.h>
|
#include <encoding/payloads/transform_substructure.h>
|
||||||
|
|
||||||
|
typedef struct diffie_hellman_t diffie_hellman_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing a diffie hellman exchange
|
* Object representing a diffie hellman exchange
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct diffie_hellman_s diffie_hellman_t;
|
struct diffie_hellman_t {
|
||||||
|
|
||||||
struct diffie_hellman_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the shared secret of this diffie hellman exchange
|
* @brief Returns the shared secret of this diffie hellman exchange
|
||||||
|
|||||||
@@ -26,23 +26,23 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
|
typedef enum hash_algorithm_t hash_algorithm_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* algorithms to use for hashing
|
* algorithms to use for hashing
|
||||||
*/
|
*/
|
||||||
typedef enum hash_algorithm_e hash_algorithm_t;
|
enum hash_algorithm_t {
|
||||||
|
|
||||||
enum hash_algorithm_e {
|
|
||||||
HASH_SHA1,
|
HASH_SHA1,
|
||||||
HASH_MD5
|
HASH_MD5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct hasher_t hasher_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing a hasher
|
* Object representing a hasher
|
||||||
*/
|
*/
|
||||||
typedef struct hasher_s hasher_t;
|
struct hasher_t {
|
||||||
|
|
||||||
struct hasher_s {
|
|
||||||
/**
|
/**
|
||||||
* @brief hash data and write it in the buffer
|
* @brief hash data and write it in the buffer
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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
|
* private data structure with hasing context
|
||||||
*/
|
*/
|
||||||
typedef struct private_hasher_md5_s private_hasher_md5_t;
|
struct private_hasher_md5_t {
|
||||||
|
|
||||||
struct private_hasher_md5_s {
|
|
||||||
/**
|
/**
|
||||||
* public interface for this hasher
|
* public interface for this hasher
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,13 +27,13 @@
|
|||||||
#include <transforms/hashers/hasher.h>
|
#include <transforms/hashers/hasher.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct hasher_md5_t hasher_md5_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing the md5 hasher
|
* Object representing the md5 hasher
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct hasher_md5_s hasher_md5_t;
|
struct hasher_md5_t {
|
||||||
|
|
||||||
struct hasher_md5_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generic hasher_t interface for this hasher
|
* generic hasher_t interface for this hasher
|
||||||
|
|||||||
@@ -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);
|
#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
|
* private data structure with hasing context
|
||||||
*/
|
*/
|
||||||
typedef struct private_hasher_sha1_s private_hasher_sha1_t;
|
struct private_hasher_sha1_t {
|
||||||
|
|
||||||
struct private_hasher_sha1_s {
|
|
||||||
/**
|
/**
|
||||||
* public interface for this hasher
|
* public interface for this hasher
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,13 +27,13 @@
|
|||||||
#include <transforms/hashers/hasher.h>
|
#include <transforms/hashers/hasher.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct hasher_sha1_t hasher_sha1_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing the sha1 hasher
|
* Object representing the sha1 hasher
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct hasher_sha1_s hasher_sha1_t;
|
struct hasher_sha1_t {
|
||||||
|
|
||||||
struct hasher_sha1_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generic hasher_t interface for this hasher
|
* generic hasher_t interface for this hasher
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file hmac.c
|
* @file hmac.c
|
||||||
*
|
*
|
||||||
* @brief Implementation of message authentication
|
* @brief Implementation of hmac_t
|
||||||
* using cryptographic hash functions (HMAC). See RFC2104.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -26,13 +24,13 @@
|
|||||||
|
|
||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
|
|
||||||
|
typedef struct private_hmac_t private_hmac_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data of an hmac_t object.
|
* Private data of an hmac_t object.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct private_hmac_s private_hmac_t;
|
struct private_hmac_t {
|
||||||
|
|
||||||
struct private_hmac_s {
|
|
||||||
/**
|
/**
|
||||||
* public hmac_t interface
|
* public hmac_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file hmac.h
|
* @file hmac.h
|
||||||
*
|
*
|
||||||
* @brief Implementation of message authentication
|
* @brief Interface of hmac_t.
|
||||||
* using cryptographic hash functions (HMAC). See RFC2104.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -24,16 +22,25 @@
|
|||||||
#ifndef HMAC_H_
|
#ifndef HMAC_H_
|
||||||
#define HMAC_H_
|
#define HMAC_H_
|
||||||
|
|
||||||
|
|
||||||
#include <transforms/hashers/hasher.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_t {
|
||||||
|
|
||||||
struct hmac_s {
|
|
||||||
/**
|
/**
|
||||||
* @brief Generate message authentication code.
|
* @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
|
* @param hash_algorithm hash algorithm to use
|
||||||
* @return
|
* @return
|
||||||
* - hmac_t if successfully
|
* - hmac_t if successfully
|
||||||
* - NULL if out of ressources or hash not supported
|
* - NULL if out of ressources or hash not supported
|
||||||
|
*
|
||||||
|
* @ingroup transforms
|
||||||
*/
|
*/
|
||||||
hmac_t *hmac_create(hash_algorithm_t hash_algorithm);
|
hmac_t *hmac_create(hash_algorithm_t hash_algorithm);
|
||||||
|
|
||||||
|
|
||||||
#endif /*HMAC_H_*/
|
#endif /*HMAC_H_*/
|
||||||
|
|||||||
@@ -26,13 +26,13 @@
|
|||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <definitions.h>
|
#include <definitions.h>
|
||||||
|
|
||||||
|
typedef struct private_prf_plus_t private_prf_plus_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data of an prf_plus_t object.
|
* Private data of an prf_plus_t object.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct private_prf_plus_s private_prf_plus_t;
|
struct private_prf_plus_t {
|
||||||
|
|
||||||
struct private_prf_plus_s {
|
|
||||||
/**
|
/**
|
||||||
* public prf_plus_t interface
|
* public prf_plus_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,12 +27,12 @@
|
|||||||
#include <transforms/prfs/prf.h>
|
#include <transforms/prfs/prf.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct prf_plus_t prf_plus_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing a prf_plus
|
* Object representing a prf_plus
|
||||||
*/
|
*/
|
||||||
typedef struct prf_plus_s prf_plus_t;
|
struct prf_plus_t {
|
||||||
|
|
||||||
struct prf_plus_s {
|
|
||||||
/**
|
/**
|
||||||
* @brief Get pseudo random bytes.
|
* @brief Get pseudo random bytes.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,12 +26,14 @@
|
|||||||
#include <encoding/payloads/transform_substructure.h>
|
#include <encoding/payloads/transform_substructure.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct prf_t prf_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing a diffie hellman exchange
|
* Object representing a diffie hellman exchange
|
||||||
|
*
|
||||||
|
* @ingroup prfs
|
||||||
*/
|
*/
|
||||||
typedef struct prf_s prf_t;
|
struct prf_t {
|
||||||
|
|
||||||
struct prf_s {
|
|
||||||
/**
|
/**
|
||||||
* @brief generates pseudo random bytes and writes them
|
* @brief generates pseudo random bytes and writes them
|
||||||
* in the buffer
|
* in the buffer
|
||||||
@@ -89,6 +91,8 @@ struct prf_s {
|
|||||||
* @return
|
* @return
|
||||||
* - prf_t if successfully
|
* - prf_t if successfully
|
||||||
* - NULL if out of ressources or prf not supported
|
* - NULL if out of ressources or prf not supported
|
||||||
|
*
|
||||||
|
* @ingroup prfs
|
||||||
*/
|
*/
|
||||||
prf_t *prf_create(pseudo_random_function_t pseudo_random_function);
|
prf_t *prf_create(pseudo_random_function_t pseudo_random_function);
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@
|
|||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <transforms/hmac.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
|
* public interface for this prf
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,13 +29,13 @@
|
|||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <transforms/hashers/hasher.h>
|
||||||
|
|
||||||
|
typedef struct prf_hmac_t prf_hmac_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing a prf using HMAC
|
* Object representing a prf using HMAC
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct prf_hmac_s prf_hmac_t;
|
struct prf_hmac_t {
|
||||||
|
|
||||||
struct prf_hmac_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generic prf_t interface for this prf
|
* generic prf_t interface for this prf
|
||||||
|
|||||||
@@ -26,12 +26,12 @@
|
|||||||
#include <encoding/payloads/transform_substructure.h>
|
#include <encoding/payloads/transform_substructure.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct signer_t signer_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object representing a diffie hellman exchange
|
* Object representing a diffie hellman exchange
|
||||||
*/
|
*/
|
||||||
typedef struct signer_s signer_t;
|
struct signer_t {
|
||||||
|
|
||||||
struct signer_s {
|
|
||||||
/**
|
/**
|
||||||
* @brief generates pseudo random bytes and writes them
|
* @brief generates pseudo random bytes and writes them
|
||||||
* in the buffer
|
* in the buffer
|
||||||
|
|||||||
+14
-4
@@ -30,7 +30,12 @@
|
|||||||
|
|
||||||
#include <definitions.h>
|
#include <definitions.h>
|
||||||
|
|
||||||
typedef enum status_e {
|
typedef enum status_t status_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return status for function calls
|
||||||
|
*/
|
||||||
|
enum status_t {
|
||||||
SUCCESS,
|
SUCCESS,
|
||||||
FAILED,
|
FAILED,
|
||||||
OUT_OF_RES,
|
OUT_OF_RES,
|
||||||
@@ -41,7 +46,7 @@ typedef enum status_e {
|
|||||||
PARSE_ERROR,
|
PARSE_ERROR,
|
||||||
VERIFY_ERROR,
|
VERIFY_ERROR,
|
||||||
INVALID_STATE
|
INVALID_STATE
|
||||||
} status_t;
|
};
|
||||||
|
|
||||||
extern mapping_t status_m[];
|
extern mapping_t status_m[];
|
||||||
|
|
||||||
@@ -52,15 +57,20 @@ typedef struct timespec timespec_t;
|
|||||||
|
|
||||||
typedef struct sockaddr sockaddr_t;
|
typedef struct sockaddr sockaddr_t;
|
||||||
|
|
||||||
|
typedef struct chunk_t chunk_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General purpose pointer/length abstraction
|
* General purpose pointer/length abstraction
|
||||||
*/
|
*/
|
||||||
typedef struct chunk_s chunk_t;
|
struct chunk_t {
|
||||||
struct chunk_s {
|
|
||||||
u_char *ptr;
|
u_char *ptr;
|
||||||
size_t len;
|
size_t len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {NULL, 0}-chunk, handy for initialization
|
||||||
|
* of chunks.
|
||||||
|
*/
|
||||||
extern chunk_t CHUNK_INITIALIZER;
|
extern chunk_t CHUNK_INITIALIZER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,14 +32,14 @@
|
|||||||
|
|
||||||
#ifdef LEAK_DETECTIVE
|
#ifdef LEAK_DETECTIVE
|
||||||
|
|
||||||
|
typedef union memory_hdr_t memory_hdr_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header of each allocated memory area
|
* Header of each allocated memory area
|
||||||
*
|
*
|
||||||
* Used to detect memory leaks
|
* Used to detect memory leaks
|
||||||
*/
|
*/
|
||||||
typedef union memory_hdr_u memory_hdr_t;
|
union memory_hdr_t {
|
||||||
|
|
||||||
union memory_hdr_u {
|
|
||||||
struct {
|
struct {
|
||||||
/**
|
/**
|
||||||
* Filename withing memory was allocated
|
* Filename withing memory was allocated
|
||||||
@@ -69,9 +69,9 @@ union memory_hdr_u {
|
|||||||
*
|
*
|
||||||
* Contains private variables of allocator_t object.
|
* 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.
|
* Public part of an allocator_t object.
|
||||||
|
|||||||
@@ -53,13 +53,13 @@
|
|||||||
|
|
||||||
#ifdef LEAK_DETECTIVE
|
#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_t {
|
||||||
|
|
||||||
struct allocator_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates memory with LEAK_DETECTION and
|
* Allocates memory with LEAK_DETECTION and
|
||||||
|
|||||||
@@ -33,13 +33,12 @@
|
|||||||
*/
|
*/
|
||||||
#define PRIMECHECK_ROUNDS 30
|
#define PRIMECHECK_ROUNDS 30
|
||||||
|
|
||||||
|
typedef struct private_gmp_helper_t private_gmp_helper_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data of an gmp_helper_t object.
|
* Private data of an gmp_helper_t object.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef struct private_gmp_helper_s private_gmp_helper_t;
|
struct private_gmp_helper_t {
|
||||||
|
|
||||||
struct private_gmp_helper_s {
|
|
||||||
/**
|
/**
|
||||||
* public gmp_helper_t interface
|
* public gmp_helper_t interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -30,13 +30,13 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#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_t {
|
||||||
|
|
||||||
struct gmp_helper_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief initialize an mpz_t to a random prime of specified size
|
* @brief initialize an mpz_t to a random prime of specified size
|
||||||
|
|||||||
@@ -27,15 +27,14 @@
|
|||||||
#include <utils/allocator.h>
|
#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.
|
* @brief Element of the linked_list.
|
||||||
*
|
*
|
||||||
* This element holds a pointer to the value of the list item itself.
|
* 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
|
* 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
|
* 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
|
* Public part of linked list
|
||||||
*/
|
*/
|
||||||
@@ -136,9 +135,9 @@ struct private_linked_list_s{
|
|||||||
* Private variables and functions of linked list iterator
|
* 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
|
* Public part of linked list iterator
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,16 +25,16 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#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
|
* This element holds a pointer to the current element in the linked list
|
||||||
*
|
*
|
||||||
* @warning the iterator is NOT thread-save
|
* @warning the iterator is NOT thread-save
|
||||||
*/
|
*/
|
||||||
typedef struct linked_list_iterator_s linked_list_iterator_t;
|
struct linked_list_iterator_t {
|
||||||
|
|
||||||
struct linked_list_iterator_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief returns TRUE if more elements are available
|
* @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);
|
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
|
* @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 event_queue_t
|
||||||
* @see send_queue_t
|
* @see send_queue_t
|
||||||
*/
|
*/
|
||||||
typedef struct linked_list_s linked_list_t;
|
struct linked_list_t {
|
||||||
|
|
||||||
|
|
||||||
struct linked_list_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief gets the count of items in the list
|
* @brief gets the count of items in the list
|
||||||
|
|||||||
@@ -37,11 +37,12 @@
|
|||||||
*/
|
*/
|
||||||
#define MAX_LOG 8192
|
#define MAX_LOG 8192
|
||||||
|
|
||||||
|
typedef struct private_logger_t private_logger_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The logger object.
|
* @brief The logger object.
|
||||||
*/
|
*/
|
||||||
typedef struct private_logger_s private_logger_t;
|
struct private_logger_t {
|
||||||
struct private_logger_s {
|
|
||||||
/**
|
/**
|
||||||
* Public data
|
* Public data
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
|
typedef enum logger_level_t logger_level_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Log Levels supported by the logger object
|
* @brief Log Levels supported by the logger object
|
||||||
*
|
*
|
||||||
@@ -37,8 +39,7 @@
|
|||||||
* as CONTROL|MORE fore a detailed cotrol level, or
|
* as CONTROL|MORE fore a detailed cotrol level, or
|
||||||
* use RAW| to see all raw data dumps (except private)
|
* use RAW| to see all raw data dumps (except private)
|
||||||
*/
|
*/
|
||||||
typedef enum logger_level_e logger_level_t;
|
enum logger_level_t {
|
||||||
enum logger_level_e {
|
|
||||||
/**
|
/**
|
||||||
* control flow
|
* control flow
|
||||||
*/
|
*/
|
||||||
@@ -75,11 +76,12 @@ enum logger_level_e {
|
|||||||
FULL = ALL + CONTROL + ERROR + RAW + PRIVATE
|
FULL = ALL + CONTROL + ERROR + RAW + PRIVATE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct logger_t logger_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The logger object
|
* @brief The logger object
|
||||||
*/
|
*/
|
||||||
typedef struct logger_s logger_t;
|
struct logger_t {
|
||||||
struct logger_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Log an entry, using printf()-like params.
|
* @brief Log an entry, using printf()-like params.
|
||||||
|
|||||||
@@ -49,8 +49,9 @@ mapping_t logger_context_t_mappings[] = {
|
|||||||
*/
|
*/
|
||||||
#define MAX_LOGGER_NAME 45
|
#define MAX_LOGGER_NAME 45
|
||||||
|
|
||||||
typedef struct private_logger_manager_s private_logger_manager_t;
|
typedef struct private_logger_manager_t private_logger_manager_t;
|
||||||
struct private_logger_manager_s {
|
|
||||||
|
struct private_logger_manager_t {
|
||||||
/**
|
/**
|
||||||
* Public data.
|
* Public data.
|
||||||
*/
|
*/
|
||||||
@@ -91,9 +92,9 @@ struct private_logger_manager_s {
|
|||||||
/**
|
/**
|
||||||
* Entry in the logger_levels linked list
|
* 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_context_t context;
|
||||||
logger_level_t level;
|
logger_level_t level;
|
||||||
};
|
};
|
||||||
@@ -101,9 +102,9 @@ struct logger_levels_entry_s{
|
|||||||
/**
|
/**
|
||||||
* Entry in the loggers linked list
|
* 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_context_t context;
|
||||||
logger_t *logger;
|
logger_t *logger;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,12 +27,12 @@
|
|||||||
|
|
||||||
#include <utils/logger.h>
|
#include <utils/logger.h>
|
||||||
|
|
||||||
|
typedef enum logger_context_t logger_context_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Context of a specific logger
|
* @brief Context of a specific logger
|
||||||
*/
|
*/
|
||||||
typedef enum logger_context_e logger_context_t;
|
enum logger_context_t {
|
||||||
|
|
||||||
enum logger_context_e{
|
|
||||||
PARSER,
|
PARSER,
|
||||||
GENERATOR,
|
GENERATOR,
|
||||||
IKE_SA,
|
IKE_SA,
|
||||||
@@ -47,14 +47,14 @@ enum logger_context_e{
|
|||||||
TESTER,
|
TESTER,
|
||||||
DAEMON,
|
DAEMON,
|
||||||
CONFIGURATION_MANAGER,
|
CONFIGURATION_MANAGER,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct logger_manager_t logger_manager_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The logger_manager_t object
|
* @brief The logger_manager_t object
|
||||||
*/
|
*/
|
||||||
typedef struct logger_manager_s logger_manager_t;
|
struct logger_manager_t {
|
||||||
|
|
||||||
struct logger_manager_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets a logger_t object for a specific logger context.
|
* @brief Gets a logger_t object for a specific logger context.
|
||||||
|
|||||||
@@ -40,9 +40,9 @@
|
|||||||
*/
|
*/
|
||||||
#define DEFAULT_PSEUDO_RANDOM_DEVICE "/dev/urandom"
|
#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
|
* public interface
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,14 +25,14 @@
|
|||||||
|
|
||||||
#include <types.h>
|
#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...
|
* This class is thread save as file system read calls are thread save...
|
||||||
*/
|
*/
|
||||||
typedef struct randomizer_s randomizer_t;
|
struct randomizer_t {
|
||||||
|
|
||||||
struct randomizer_s {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reads a specific number of bytes from random device.
|
* @brief Reads a specific number of bytes from random device.
|
||||||
|
|||||||
@@ -32,13 +32,14 @@
|
|||||||
#include <utils/linked_list.h>
|
#include <utils/linked_list.h>
|
||||||
#include <queues/job_queue.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_t {
|
||||||
|
|
||||||
struct private_tester_s {
|
|
||||||
tester_t public;
|
tester_t public;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,22 +29,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct test_t test_t;
|
||||||
|
|
||||||
|
typedef struct tester_t tester_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Specifies a test
|
* @brief Specifies a test
|
||||||
*/
|
*/
|
||||||
typedef struct test_s test_t;
|
struct test_t {
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief A tester object to perform tests with
|
|
||||||
*/
|
|
||||||
typedef struct tester_s tester_t;
|
|
||||||
|
|
||||||
struct test_s{
|
|
||||||
void (*test_function) (tester_t * tester);
|
void (*test_function) (tester_t * tester);
|
||||||
char * test_name;
|
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
|
* @brief Tests all testcases in array tests with specific tester object
|
||||||
|
|||||||
Reference in New Issue
Block a user