ff4b4a1e997bc7a1931fd380b90e076fd2e0ddab
2 * Copyright (C) 2006 Martin Willi
3 * Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * @defgroup debug debug
18 * @{ @ingroup libstrongswan
24 typedef enum debug_t debug_t
;
25 typedef enum level_t level_t
;
32 * Debug message group.
35 /** daemon specific */
45 /** configuration backends */
47 /** kernel interface */
49 /** networking/sockets */
51 /** low-level encoding/decoding (ASN.1, X.509 etc.) */
53 /** message encoding/decoding */
55 /** trusted network connect */
57 /** integrity measurement client */
59 /** integrity measurement verifier */
61 /** platform trust service */
65 /** applications other than daemons */
71 /** number of groups */
73 /** pseudo group with all groups */
78 * short names of debug message group.
80 extern enum_name_t
*debug_names
;
83 * short names of debug message group, lower case.
85 extern enum_name_t
*debug_lower_names
;
88 * Debug levels used to control output verbosity.
91 /** absolutely silent */
93 /** most important auditing logs */
97 /** diagnose problems */
99 /** raw binary blobs */
101 /** including sensitive data (private keys) */
106 # define DEBUG_LEVEL 4
107 #endif /* DEBUG_LEVEL */
109 /** debug macros, they call the dbg function hook */
111 # define DBG0(group, fmt, ...) dbg(group, 0, fmt, ##__VA_ARGS__)
112 #endif /* DEBUG_LEVEL */
114 # define DBG1(group, fmt, ...) dbg(group, 1, fmt, ##__VA_ARGS__)
115 #endif /* DEBUG_LEVEL */
117 # define DBG2(group, fmt, ...) dbg(group, 2, fmt, ##__VA_ARGS__)
118 #endif /* DEBUG_LEVEL */
120 # define DBG3(group, fmt, ...) dbg(group, 3, fmt, ##__VA_ARGS__)
121 #endif /* DEBUG_LEVEL */
123 # define DBG4(group, fmt, ...) dbg(group, 4, fmt, ##__VA_ARGS__)
124 #endif /* DEBUG_LEVEL */
127 # define DBG0(...) {}
130 # define DBG1(...) {}
133 # define DBG2(...) {}
136 # define DBG3(...) {}
139 # define DBG4(...) {}
142 /** dbg function hook, uses dbg_default() by default */
143 extern void (*dbg
) (debug_t group
, level_t level
, char *fmt
, ...);
145 /** default logging function */
146 void dbg_default(debug_t group
, level_t level
, char *fmt
, ...);
148 /** set the level logged by dbg_default() */
149 void dbg_default_set_level(level_t level
);
151 /** set the stream logged by dbg_default() to */
152 void dbg_default_set_stream(FILE *stream
);
154 #endif /** DEBUG_H_ @}*/