diff options
author | Jan Hutter <jhutter@hsr.ch> | 2005-12-06 13:07:06 +0000 |
---|---|---|
committer | Jan Hutter <jhutter@hsr.ch> | 2005-12-06 13:07:06 +0000 |
commit | b23b556ae71a64ee530cd0ef80de0c50f9aca3ae (patch) | |
tree | 09db2a1ec08948dbdce55590ef0a61452aaadaec /Source | |
parent | f1802881f602c883064e3436d5abbb262269c808 (diff) | |
download | strongswan-b23b556ae71a64ee530cd0ef80de0c50f9aca3ae.tar.bz2 strongswan-b23b556ae71a64ee530cd0ef80de0c50f9aca3ae.tar.xz |
- code cleaned up
Diffstat (limited to 'Source')
-rw-r--r-- | Source/charon/types.c | 9 | ||||
-rw-r--r-- | Source/charon/types.h | 84 |
2 files changed, 83 insertions, 10 deletions
diff --git a/Source/charon/types.c b/Source/charon/types.c index ca4aaff0c..47a763e83 100644 --- a/Source/charon/types.c +++ b/Source/charon/types.c @@ -1,7 +1,7 @@ /** * @file types.c * - * @brief Generic type definitions + * @brief Generic types. * */ @@ -23,7 +23,9 @@ #include "types.h" - +/** + * String mappings for type status_t. + */ mapping_t status_m[] = { {SUCCESS, "SUCCESS"}, {FAILED, "FAILED"}, @@ -40,4 +42,7 @@ mapping_t status_m[] = { {MAPPING_END, NULL} }; +/** + * Empty chunk. + */ chunk_t CHUNK_INITIALIZER = {NULL,0}; diff --git a/Source/charon/types.h b/Source/charon/types.h index 09a669cf4..9c405dee5 100644 --- a/Source/charon/types.h +++ b/Source/charon/types.h @@ -1,7 +1,7 @@ /** * @file types.h * - * @brief Generic type definitions + * @brief Generic types. * */ @@ -30,42 +30,112 @@ #include <definitions.h> + typedef enum status_t status_t; /** - * return status for function calls + * Return values of function calls. */ enum status_t { + /** + * Call succeeded. + */ SUCCESS, + + /** + * Call failed. + */ FAILED, + + /** + * Out of ressources. + */ + OUT_OF_RES, + /** + * Already done. + */ ALREADY_DONE, + + /** + * Not supported. + */ NOT_SUPPORTED, + + /** + * One of the arguments is invalid. + */ INVALID_ARG, + + /** + * Something could not be found. + */ NOT_FOUND, + + /** + * Error while parsing. + */ PARSE_ERROR, + + /** + * Error while verifying. + */ VERIFY_ERROR, + + /** + * Object in invalid state. + */ INVALID_STATE, + + /** + * Delete object which function belongs to. + */ DELETE_ME, + + /** + * An object got created. + */ CREATED, }; -extern mapping_t status_m[]; +/** + * String mappings for type status_t. + */ +extern mapping_t status_m[]; +/** + * Handle struct timeval like an own type. + */ typedef struct timeval timeval_t; +/** + * Handle struct timespec like an own type. + */ typedef struct timespec timespec_t; +/** + * Handle struct chunk_t like an own type. + */ typedef struct sockaddr sockaddr_t; +/** + * Use struct chunk_t as chunk_t. + */ typedef struct chunk_t chunk_t; /** - * General purpose pointer/length abstraction + * General purpose pointer/length abstraction. */ struct chunk_t { + /** + * Pointer to start of data + */ u_char *ptr; + + /** + * Length of data in bytes + */ size_t len; }; @@ -76,12 +146,10 @@ struct chunk_t { extern chunk_t CHUNK_INITIALIZER; /** - * General purpose boolean type + * General purpose boolean type. */ typedef int bool; #define FALSE 0 -#define TRUE 1 - - +#define TRUE 1 #endif /*TYPES_H_*/ |