merged the modularization branch (credentials) back to trunk
This commit is contained in:
+34
-21
@@ -1,12 +1,5 @@
|
||||
/**
|
||||
* @file enum.h
|
||||
*
|
||||
* @brief enum value to string conversion functions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 Martin Willi
|
||||
* Copyright (C) 2006-2008 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -18,15 +11,24 @@
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup enum enum
|
||||
* @{ @ingroup libstrongswan
|
||||
*/
|
||||
|
||||
#ifndef ENUM_H_
|
||||
#define ENUM_H_
|
||||
|
||||
#include <printf_hook.h>
|
||||
|
||||
typedef struct enum_name_t enum_name_t;
|
||||
|
||||
/**
|
||||
* @brief Struct to store names for enums.
|
||||
* Struct to store names for enums.
|
||||
*
|
||||
* To print the string representation of enumeration values, the strings
|
||||
* are stored in these structures. Every enum_name contains a range
|
||||
@@ -34,14 +36,16 @@ typedef struct enum_name_t enum_name_t;
|
||||
* Use the convenience macros to define these linked ranges.
|
||||
*
|
||||
* For a single range, use:
|
||||
* ENUM(name, first, last, string1, string2, ...)
|
||||
*
|
||||
* @code
|
||||
ENUM(name, first, last, string1, string2, ...)
|
||||
@endcode
|
||||
* For multiple linked ranges, use:
|
||||
* ENUM_BEGIN(name, first, last, string1, string2, ...)
|
||||
* ENUM_NEXT(name, first, last, last_from_previous, string3, ...)
|
||||
* ENUM_NEXT(name, first, last, last_from_previous, string4, ...)
|
||||
* ENUM_END(name, last_from_previous)
|
||||
*
|
||||
* @code
|
||||
ENUM_BEGIN(name, first, last, string1, string2, ...)
|
||||
ENUM_NEXT(name, first, last, last_from_previous, string3, ...)
|
||||
ENUM_NEXT(name, first, last, last_from_previous, string4, ...)
|
||||
ENUM_END(name, last_from_previous)
|
||||
@endcode
|
||||
* The ENUM and the ENUM_END define a enum_name_t pointer with the name supplied
|
||||
* in "name".
|
||||
*
|
||||
@@ -62,7 +66,7 @@ struct enum_name_t {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Begin a new enum_name list.
|
||||
* Begin a new enum_name list.
|
||||
*
|
||||
* @param name name of the enum_name list
|
||||
* @param first enum value of the first enum string
|
||||
@@ -72,7 +76,7 @@ struct enum_name_t {
|
||||
#define ENUM_BEGIN(name, first, last, ...) static enum_name_t name##last = {first, last, NULL, { __VA_ARGS__ }}
|
||||
|
||||
/**
|
||||
* @brief Continue a enum name list startetd with ENUM_BEGIN.
|
||||
* Continue a enum name list startetd with ENUM_BEGIN.
|
||||
*
|
||||
* @param name name of the enum_name list
|
||||
* @param first enum value of the first enum string
|
||||
@@ -83,7 +87,7 @@ struct enum_name_t {
|
||||
#define ENUM_NEXT(name, first, last, prev, ...) static enum_name_t name##last = {first, last, &name##prev, { __VA_ARGS__ }}
|
||||
|
||||
/**
|
||||
* @brief Complete enum name list started with ENUM_BEGIN.
|
||||
* Complete enum name list started with ENUM_BEGIN.
|
||||
*
|
||||
* @param name name of the enum_name list
|
||||
* @param prev enum value of the "last" defined in ENUM_BEGIN/previous ENUM_NEXT
|
||||
@@ -91,7 +95,7 @@ struct enum_name_t {
|
||||
#define ENUM_END(name, prev) enum_name_t *name = &name##prev;
|
||||
|
||||
/**
|
||||
* @brief Define a enum name with only one range.
|
||||
* Define a enum name with only one range.
|
||||
*
|
||||
* This is a convenience macro to use when a enum_name list contains only
|
||||
* one range, and is equal as defining ENUM_BEGIN followed by ENUM_END.
|
||||
@@ -103,4 +107,13 @@ struct enum_name_t {
|
||||
*/
|
||||
#define ENUM(name, first, last, ...) ENUM_BEGIN(name, first, last, __VA_ARGS__); ENUM_END(name, last)
|
||||
|
||||
#endif /* ENUM_H_ */
|
||||
/**
|
||||
* Get printf hook functions for enum_names_t.
|
||||
*
|
||||
* The handler takes the arguments: enum_names_t *names, int value
|
||||
*
|
||||
* @return printf hook functions
|
||||
*/
|
||||
printf_hook_functions_t enum_get_printf_hooks();
|
||||
|
||||
#endif /* ENUM_H_ @}*/
|
||||
|
||||
Reference in New Issue
Block a user