- code cleaned up
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file definitions.c
|
* @file definitions.c
|
||||||
*
|
*
|
||||||
* @brief general purpose functions used in definitions.h
|
* @brief General purpose definitions and macros.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* see header
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
char *mapping_find(mapping_t * maps, int value)
|
char *mapping_find(mapping_t * maps, int value)
|
||||||
{
|
{
|
||||||
|
|||||||
+19
-49
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file definitions.h
|
* @file definitions.h
|
||||||
*
|
*
|
||||||
* @brief general purpose definitions and macros
|
* @brief General purpose definitions and macros.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -63,13 +63,13 @@
|
|||||||
/**
|
/**
|
||||||
* @defgroup config
|
* @defgroup config
|
||||||
*
|
*
|
||||||
* Classes which implement configuration related things.
|
* Classes implementing configuration related things.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup encoding
|
* @defgroup encoding
|
||||||
*
|
*
|
||||||
* Classes used to encode and decode IKEv2 Messages.
|
* Classes used to encode and decode IKEv2 messages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
/**
|
/**
|
||||||
* @defgroup payloads
|
* @defgroup payloads
|
||||||
*
|
*
|
||||||
* Classes representing a specific IKEv2 Payload.
|
* Classes representing specific IKEv2 payloads.
|
||||||
*
|
*
|
||||||
* @ingroup encoding
|
* @ingroup encoding
|
||||||
*/
|
*/
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
/**
|
/**
|
||||||
* @defgroup sa
|
* @defgroup sa
|
||||||
*
|
*
|
||||||
* Security association with all helber classes.
|
* Security association and helper classes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
/**
|
/**
|
||||||
* @defgroup rsa
|
* @defgroup rsa
|
||||||
*
|
*
|
||||||
* RSA public key algorithm
|
* RSA public key algorithm.
|
||||||
*
|
*
|
||||||
* @ingroup transforms
|
* @ingroup transforms
|
||||||
*/
|
*/
|
||||||
@@ -138,8 +138,7 @@
|
|||||||
/**
|
/**
|
||||||
* @defgroup prfs
|
* @defgroup prfs
|
||||||
*
|
*
|
||||||
* Pseudo random functions, generate a lot of pseudo
|
* Pseudo random functions.
|
||||||
* randomness using random numbers.
|
|
||||||
*
|
*
|
||||||
* @ingroup transforms
|
* @ingroup transforms
|
||||||
*/
|
*/
|
||||||
@@ -147,8 +146,7 @@
|
|||||||
/**
|
/**
|
||||||
* @defgroup signers
|
* @defgroup signers
|
||||||
*
|
*
|
||||||
* Symmetric signing algorithms, used to ensure
|
* Symmetric signing algorithms, used to ensure message integrity.
|
||||||
* message integrity.
|
|
||||||
*
|
*
|
||||||
* @ingroup transforms
|
* @ingroup transforms
|
||||||
*/
|
*/
|
||||||
@@ -156,8 +154,7 @@
|
|||||||
/**
|
/**
|
||||||
* @defgroup crypters
|
* @defgroup crypters
|
||||||
*
|
*
|
||||||
* Symmetric encryption algorithms, used to en-
|
* Symmetric encryption algorithms, used to encrypt and decrypt.
|
||||||
* and decrypt.
|
|
||||||
*
|
*
|
||||||
* @ingroup transforms
|
* @ingroup transforms
|
||||||
*/
|
*/
|
||||||
@@ -167,30 +164,6 @@
|
|||||||
*
|
*
|
||||||
* Hashing algorithms.
|
* Hashing algorithms.
|
||||||
*
|
*
|
||||||
* Example for using hasher_t:
|
|
||||||
* @code
|
|
||||||
* chunk_t data;
|
|
||||||
* chunk_t md5_hash;
|
|
||||||
* u_int8_t sha1_hash[20];
|
|
||||||
*
|
|
||||||
* hasher_t *hasher;
|
|
||||||
*
|
|
||||||
* data.ptr = "string to hash";
|
|
||||||
* data.len = strlen(data.ptr);
|
|
||||||
*
|
|
||||||
* // use MD5, allocate hash
|
|
||||||
* hasher = hasher_create(HASH_MD5);
|
|
||||||
* hasher->allocate_hash(hasher, data, &hash);
|
|
||||||
* hasher->destroy(hasher);
|
|
||||||
*
|
|
||||||
* // use SHA1, hash in buffer
|
|
||||||
* hasher = hasher_create(HASH_SHA1);
|
|
||||||
* hasher->get_hash(hasher, data, &sha1_hash);
|
|
||||||
* hasher->destroy(hasher);
|
|
||||||
* @endcode
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @ingroup transforms
|
* @ingroup transforms
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -203,49 +176,46 @@
|
|||||||
/**
|
/**
|
||||||
* @defgroup threads
|
* @defgroup threads
|
||||||
*
|
*
|
||||||
* Threaded classes, which will do their
|
* Threaded classes, which will do their job alone.
|
||||||
* job alone.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro gives back larger of two values
|
* Macro gives back larger of two values.
|
||||||
*/
|
*/
|
||||||
#define max(x,y) (x > y ? x : y)
|
#define max(x,y) (x > y ? x : y)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro gives back smaller of two values
|
* Macro gives back smaller of two values.
|
||||||
*/
|
*/
|
||||||
#define min(x,y) (x < y ? x : y)
|
#define min(x,y) (x < y ? x : y)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mapping entry which defines the end of a mapping_t array
|
* Papping entry which defines the end of a mapping_t array.
|
||||||
*/
|
*/
|
||||||
#define MAPPING_END (-1)
|
#define MAPPING_END (-1)
|
||||||
|
|
||||||
|
|
||||||
typedef struct mapping_t mapping_t;
|
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.
|
||||||
*/
|
*/
|
||||||
struct mapping_t
|
struct mapping_t
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* enumeration value
|
* Enumeration value.
|
||||||
*/
|
*/
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mapped string
|
* Mapped string.
|
||||||
*/
|
*/
|
||||||
char *string;
|
char *string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief find a mapping_string in the mapping[]
|
* @brief Find a mapping_string in the mapping[].
|
||||||
*
|
*
|
||||||
* @param mappings mappings array
|
* @param mappings mappings array
|
||||||
* @param value enum-value to get the string from
|
* @param value enum-value to get the string from
|
||||||
|
|||||||
Reference in New Issue
Block a user