diff options
Diffstat (limited to 'Source/lib')
-rw-r--r-- | Source/lib/Makefile.lib | 2 | ||||
-rw-r--r-- | Source/lib/definitions.h | 138 | ||||
-rw-r--r-- | Source/lib/library.h | 100 | ||||
-rw-r--r-- | Source/lib/utils/identification.h | 39 | ||||
-rw-r--r-- | Source/lib/utils/leak_detective.c | 6 | ||||
-rw-r--r-- | Source/lib/utils/logger_manager.h | 8 |
6 files changed, 113 insertions, 180 deletions
diff --git a/Source/lib/Makefile.lib b/Source/lib/Makefile.lib index f18ea2df5..0e8c359bd 100644 --- a/Source/lib/Makefile.lib +++ b/Source/lib/Makefile.lib @@ -23,7 +23,7 @@ $(BUILD_DIR)definitions.o : $(LIB_DIR)definitions.c $(LIB_DIR)definitions.h $(CC) $(CFLAGS) -c -o $@ $< LIB_OBJS+= $(BUILD_DIR)library.o -$(BUILD_DIR)library.o : $(LIB_DIR)library.c +$(BUILD_DIR)library.o : $(LIB_DIR)library.c $(LIB_DIR)library.h $(CC) $(CFLAGS) -c -o $@ $< include $(MAIN_DIR)lib/crypto/Makefile.transforms diff --git a/Source/lib/definitions.h b/Source/lib/definitions.h index 11bd04f74..c9ef066c1 100644 --- a/Source/lib/definitions.h +++ b/Source/lib/definitions.h @@ -60,133 +60,6 @@ #endif - -/** - * @defgroup config config - * - * Classes implementing configuration related things. - */ - -/** - * @defgroup encoding encoding - * - * Classes used to encode and decode IKEv2 messages. - */ - -/** - * @defgroup network network - * - * Classes for network relevant stuff. - */ - - /** - * @defgroup payloads payloads - * - * Classes representing specific IKEv2 payloads. - * - * @ingroup encoding - */ - -/** - * @defgroup sa sa - * - * Security association and helper classes. - */ - - -/** - * @defgroup states states - * - * Varius states in which an IKE SA can be. - * - * @ingroup sa - */ - -/** - * @defgroup queues queues - * - * Different kind of queues. - */ - - /** - * @defgroup jobs jobs - * - * Jobs used in job queue and event queue. - * - * @ingroup queues - */ - -/** - * @defgroup testcases testcases - * - * Testcases used to test the different classes in seperate module tests. - */ - -/** - * @defgroup transforms transforms - * - * Transform algorithms of different kind. - */ - -/** - * @defgroup rsa rsa - * - * RSA public key algorithm. - * - * @ingroup transforms - */ - -/** - * @defgroup prfs prfs - * - * Pseudo random functions. - * - * @ingroup transforms - */ - -/** - * @defgroup signers signers - * - * Symmetric signing algorithms, used to ensure message integrity. - * - * @ingroup transforms - */ - -/** - * @defgroup crypters crypters - * - * Symmetric encryption algorithms, used to encrypt and decrypt. - * - * @ingroup transforms - */ - -/** - * @defgroup hashers hashers - * - * Hashing algorithms. - * - * @ingroup transforms - */ -/** - * @defgroup asn1 asn1 - * - * ASN1 structure definition, en-/decoder of for DER - * - * @todo Implement a der_encoder_t class. - */ - -/** - * @defgroup utils utils - * - * Generic helper classes. - */ - -/** - * @defgroup threads threads - * - * Threaded classes, which will do their job alone. - */ - /** * Macro gives back larger of two values. */ @@ -202,22 +75,15 @@ */ #define POS printf("%s, line %d\n", __FILE__, __LINE__) - - - /** - * Macro to allocate a type as chunk_t. + * Macro to allocate a sized type. * * @param thing object on which a sizeof is performed - * @return chunk_t pointing to allocated memory + * @return poiner to allocated memory */ #define malloc_thing(thing) ((thing*)malloc(sizeof(thing))) - - - - /** * Mapping entry which defines the end of a mapping_t array. */ diff --git a/Source/lib/library.h b/Source/lib/library.h new file mode 100644 index 000000000..da96befe1 --- /dev/null +++ b/Source/lib/library.h @@ -0,0 +1,100 @@ +/** + * @file library.h + * + * @brief Global library header. + * + */ + +/* + * Copyright (C) 2006 Martin Willi + * Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef LIBRARY_H_ +#define LIBRARY_H_ + +/** + * @defgroup lib lib + * + * libstrongswan: library with various crypto related things. + */ + +/** + * @defgroup asn1 asn1 + * + * ASN1 definitions, parser and generator functions. + * + * @ingroup lib + */ + +/** + * @defgroup crypto crypto + * + * Crypto algorithms of different kind. + * + * @ingroup lib + */ + +/** + * @defgroup crypters crypters + * + * Symmetric encryption algorithms, used for + * encryption and decryption. + * + * @ingroup crypto + */ + +/** + * @defgroup hashers hashers + * + * Hashing algorithms, such as MD5 or SHA1 + * + * @ingroup crypto + */ + +/** + * @defgroup prfs prfs + * + * Pseudo random functions, used to generate + * pseude random byte sequences. + * + * @ingroup crypto + */ + +/** + * @defgroup rsa rsa + * + * RSA private/public key algorithm. + * + * @ingroup crypto + */ + +/** + * @defgroup signers signers + * + * Symmetric signing algorithms, + * used to ensure message integrity. + * + * @ingroup crypto + */ + +/** + * @defgroup utils utils + * + * Generic helper classes. + * + * @ingroup lib + */ + + +#endif /* LIBRARY_H_ */ diff --git a/Source/lib/utils/identification.h b/Source/lib/utils/identification.h index 30796bd56..87ac2a8b2 100644 --- a/Source/lib/utils/identification.h +++ b/Source/lib/utils/identification.h @@ -85,21 +85,6 @@ enum id_type_t { }; /** - * Old pluto id format - * - * @deprecated Do not use any more, only here for pluto. - */ -// struct id { -// /** ID_* value, pluto pendant to id_type_t */ -// int kind; -// /** ID_IPV4_ADDR, ID_IPV6_ADDR */ -// ip_address ip_addr; -// /** ID_FQDN, ID_USER_FQDN (with @) */ -// /** ID_KEY_ID, ID_DER_ASN_DN */ -// chunk_t name; -// }; - -/** * String mappings for id_type_t. */ extern mapping_t id_type_m[]; @@ -159,17 +144,6 @@ struct identification_t { char *(*get_string) (identification_t *this); /** - * @brief Get the id in the format used in pluto. - * - * We do this in pluto style here, which means no memory - * is allocated. - * - * @param this the identification_t object - * @return string - */ - // void (*get_pluto_id) (identification_t *this, struct id *pluto_id); - - /** * @brief Check if two identification_t objects are equal. * * @param this the identification_t object @@ -232,18 +206,5 @@ identification_t * identification_create_from_string(id_type_t type, char *strin */ identification_t * identification_create_from_encoding(id_type_t type, chunk_t encoded); -/** - * @brief Creates an identification_t object from the old pluto id format. - * - * Pluto uses struct id for identification stuff. Since we need to convert from - * this format to our identification_t, we need this special constructor. - * - * @param id old pluto format id - * @return identification_t object - * - * @ingroup utils - */ -// identification_t * identification_create_from_pluto_id(struct id *pluto_id); - #endif /* IDENTIFICATION_H_ */ diff --git a/Source/lib/utils/leak_detective.c b/Source/lib/utils/leak_detective.c index 72b14bb46..06d8916ac 100644 --- a/Source/lib/utils/leak_detective.c +++ b/Source/lib/utils/leak_detective.c @@ -1,7 +1,7 @@ /** * @file leak_detective.c * - * @brief Implementation of leak_detective_t. + * @brief Allocation hooks to find memory leaks. */ /* @@ -31,7 +31,6 @@ #include <dlfcn.h> #include <unistd.h> #include <syslog.h> -#define __USE_GNU /* needed for recursiv mutex initializer */ #include <pthread.h> #include "leak_detective.h" @@ -120,8 +119,7 @@ static bool installed = FALSE; /** * Mutex to exclusivly uninstall hooks, access heap list */ -static pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /** diff --git a/Source/lib/utils/logger_manager.h b/Source/lib/utils/logger_manager.h index 3cfba7365..a3ff5a37e 100644 --- a/Source/lib/utils/logger_manager.h +++ b/Source/lib/utils/logger_manager.h @@ -145,8 +145,16 @@ struct logger_manager_t { */ extern logger_manager_t *logger_manager; +/** + * Initialize the logger manager with all its logger. + * Has to be called before logger_manager is accessed. + */ void logger_manager_init(); +/** + * Free any resources hold by the logger manager. Do + * not access logger_manager after this call. + */ void logger_manager_cleanup(); #endif /*LOGGER_MANAGER_H_*/ |