a6e2ba6f35f81ae02a2f7016e7d4ca737a0cd664
4 * @brief general purpose definitions and macros
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 * Copyright (C) 1998, 1999 D. Hugh Redelmeier. (Endian stuff)
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 #ifndef DEFINITIONS_H_
25 #define DEFINITIONS_H_
29 /* stolen from strongswan */
31 # if defined(i386) && !defined(__i386__)
33 # define MYHACKFORTHIS 1
40 #elif !(defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN) && defined(BYTE_ORDER))
41 /* we don't know how to do this, so we require the macros to be defined
42 * with compiler flags:
43 * -DBIG_ENDIAN=4321 -DLITTLE_ENDIAN=1234 -DBYTE_ORDER=BIG_ENDIAN
44 * or -DBIG_ENDIAN=4321 -DLITTLE_ENDIAN=1234 -DBYTE_ORDER=LITTLE_ENDIAN
45 * Thse match the GNU definitions
47 # include <sys/endian.h>
51 #error "BIG_ENDIAN must be defined"
55 #error "LITTLE_ENDIAN must be defined"
59 #error "BYTE_ORDER must be defined"
63 * Doxygen namespace support
68 * @addtogroup transforms
70 * Transform algorithms of different kind.
76 * Pseudo random functions, generate a lot of pseudo
77 * randomness using random numbers.
85 * Symmetric signing algorithms, used to ensure
92 * @addtogroup crypters
94 * Symmetric encryption algorithms, used to en-
101 * @addtogroup hashers
105 * @ingroup transforms
111 * Generic helper classes.
115 * macro gives back larger of two values
117 #define max(x,y) (x > y ? x : y)
121 * macro gives back smaller of two values
123 #define min(x,y) (x < y ? x : y)
127 * mapping entry which defines the end of a mapping_t array
129 #define MAPPING_END (-1)
131 typedef struct mapping_t mapping_t
;
134 * @brief mapping entry, where enum-to-string mappings are stored.
150 * @brief find a mapping_string in the mapping[]
152 * @param mappings mappings array
153 * @param value enum-value to get the string from
156 char *mapping_find(mapping_t
*mappings
, int value
);
162 #endif /*DEFINITIONS_H_*/