]>
git.ipfire.org Git - thirdparty/strongswan.git/blob - Source/charon/definitions.h
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"
66 * Configuration stuff.
72 * Classes used to encode and decode IKEv2 Messages.
78 * Low level network stuff.
84 * Classes representing a specific IKEv2 Payload type.
92 * Security association with all helber classes.
99 * Varius states in which an IKE SA can be.
107 * Different kind of queues.
113 * Jobs used in job queue and event queue.
119 * @defgroup testcases
121 * Testcases used to test the different classes in seperate module tests.
125 * @defgroup transforms
127 * Transform algorithms of different kind.
133 * Pseudo random functions, generate a lot of pseudo
134 * randomness using random numbers.
136 * @ingroup transforms
142 * Symmetric signing algorithms, used to ensure
145 * @ingroup transforms
151 * Symmetric encryption algorithms, used to en-
154 * @ingroup transforms
160 * Hashing algorithms.
162 * Example for using hasher_t:
166 * u_int8_t sha1_hash[20];
170 * data.ptr = "string to hash";
171 * data.len = strlen(data.ptr);
173 * // use MD5, allocate hash
174 * hasher = hasher_create(HASH_MD5);
175 * hasher->allocate_hash(hasher, data, &hash);
176 * hasher->destroy(hasher);
178 * // use SHA1, hash in buffer
179 * hasher = hasher_create(HASH_SHA1);
180 * hasher->get_hash(hasher, data, &sha1_hash);
181 * hasher->destroy(hasher);
186 * @ingroup transforms
192 * Generic helper classes.
198 * Threaded classes, which will do their
205 * macro gives back larger of two values
207 #define max(x,y) (x > y ? x : y)
211 * macro gives back smaller of two values
213 #define min(x,y) (x < y ? x : y)
217 * mapping entry which defines the end of a mapping_t array
219 #define MAPPING_END (-1)
221 typedef struct mapping_t mapping_t
;
224 * @brief mapping entry, where enum-to-string mappings are stored.
240 * @brief find a mapping_string in the mapping[]
242 * @param mappings mappings array
243 * @param value enum-value to get the string from
246 char *mapping_find(mapping_t
*mappings
, int value
);
250 * Default random device used when no device is given.
252 #define DEFAULT_RANDOM_DEVICE "/dev/random"
255 * Pseudo random device used when no device is given.
257 #define DEFAULT_PSEUDO_RANDOM_DEVICE "/dev/urandom"
260 #endif /*DEFINITIONS_H_*/