xref: /freebsd-src/contrib/wpa/src/utils/wpa_debug.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
139beb93cSSam Leffler /*
239beb93cSSam Leffler  * wpa_supplicant/hostapd / Debug prints
35b9c547cSRui Paulo  * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
439beb93cSSam Leffler  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
739beb93cSSam Leffler  */
839beb93cSSam Leffler 
939beb93cSSam Leffler #ifndef WPA_DEBUG_H
1039beb93cSSam Leffler #define WPA_DEBUG_H
1139beb93cSSam Leffler 
1239beb93cSSam Leffler #include "wpabuf.h"
1339beb93cSSam Leffler 
145b9c547cSRui Paulo extern int wpa_debug_level;
155b9c547cSRui Paulo extern int wpa_debug_show_keys;
165b9c547cSRui Paulo extern int wpa_debug_timestamp;
1785732ac8SCy Schubert extern int wpa_debug_syslog;
185b9c547cSRui Paulo 
1939beb93cSSam Leffler /* Debugging function - conditional printf and hex dump. Driver wrappers can
2039beb93cSSam Leffler  * use these for debugging purposes. */
2139beb93cSSam Leffler 
22f05cddf9SRui Paulo enum {
23f05cddf9SRui Paulo 	MSG_EXCESSIVE, MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR
24f05cddf9SRui Paulo };
2539beb93cSSam Leffler 
2639beb93cSSam Leffler #ifdef CONFIG_NO_STDOUT_DEBUG
2739beb93cSSam Leffler 
2839beb93cSSam Leffler #define wpa_debug_print_timestamp() do { } while (0)
2939beb93cSSam Leffler #define wpa_printf(args...) do { } while (0)
3039beb93cSSam Leffler #define wpa_hexdump(l,t,b,le) do { } while (0)
3139beb93cSSam Leffler #define wpa_hexdump_buf(l,t,b) do { } while (0)
3239beb93cSSam Leffler #define wpa_hexdump_key(l,t,b,le) do { } while (0)
3339beb93cSSam Leffler #define wpa_hexdump_buf_key(l,t,b) do { } while (0)
3439beb93cSSam Leffler #define wpa_hexdump_ascii(l,t,b,le) do { } while (0)
3539beb93cSSam Leffler #define wpa_hexdump_ascii_key(l,t,b,le) do { } while (0)
3639beb93cSSam Leffler #define wpa_debug_open_file(p) do { } while (0)
3739beb93cSSam Leffler #define wpa_debug_close_file() do { } while (0)
385b9c547cSRui Paulo #define wpa_debug_setup_stdout() do { } while (0)
39f05cddf9SRui Paulo #define wpa_dbg(args...) do { } while (0)
40f05cddf9SRui Paulo 
41f05cddf9SRui Paulo static inline int wpa_debug_reopen_file(void)
42f05cddf9SRui Paulo {
43f05cddf9SRui Paulo 	return 0;
44f05cddf9SRui Paulo }
4539beb93cSSam Leffler 
4639beb93cSSam Leffler #else /* CONFIG_NO_STDOUT_DEBUG */
4739beb93cSSam Leffler 
4839beb93cSSam Leffler int wpa_debug_open_file(const char *path);
49f05cddf9SRui Paulo int wpa_debug_reopen_file(void);
5039beb93cSSam Leffler void wpa_debug_close_file(void);
515b9c547cSRui Paulo void wpa_debug_setup_stdout(void);
52*a90b9d01SCy Schubert void wpa_debug_stop_log(void);
5339beb93cSSam Leffler 
5439beb93cSSam Leffler /**
5539beb93cSSam Leffler  * wpa_debug_printf_timestamp - Print timestamp for debug output
5639beb93cSSam Leffler  *
5739beb93cSSam Leffler  * This function prints a timestamp in seconds_from_1970.microsoconds
5839beb93cSSam Leffler  * format if debug output has been configured to include timestamps in debug
5939beb93cSSam Leffler  * messages.
6039beb93cSSam Leffler  */
6139beb93cSSam Leffler void wpa_debug_print_timestamp(void);
6239beb93cSSam Leffler 
6339beb93cSSam Leffler /**
6439beb93cSSam Leffler  * wpa_printf - conditional printf
6539beb93cSSam Leffler  * @level: priority level (MSG_*) of the message
6639beb93cSSam Leffler  * @fmt: printf format string, followed by optional arguments
6739beb93cSSam Leffler  *
6839beb93cSSam Leffler  * This function is used to print conditional debugging and error messages. The
6939beb93cSSam Leffler  * output may be directed to stdout, stderr, and/or syslog based on
7039beb93cSSam Leffler  * configuration.
7139beb93cSSam Leffler  *
7239beb93cSSam Leffler  * Note: New line '\n' is added to the end of the text when printing to stdout.
7339beb93cSSam Leffler  */
743157ba21SRui Paulo void wpa_printf(int level, const char *fmt, ...)
7539beb93cSSam Leffler PRINTF_FORMAT(2, 3);
7639beb93cSSam Leffler 
7739beb93cSSam Leffler /**
7839beb93cSSam Leffler  * wpa_hexdump - conditional hex dump
7939beb93cSSam Leffler  * @level: priority level (MSG_*) of the message
8039beb93cSSam Leffler  * @title: title of for the message
8139beb93cSSam Leffler  * @buf: data buffer to be dumped
8239beb93cSSam Leffler  * @len: length of the buf
8339beb93cSSam Leffler  *
8439beb93cSSam Leffler  * This function is used to print conditional debugging and error messages. The
8539beb93cSSam Leffler  * output may be directed to stdout, stderr, and/or syslog based on
8639beb93cSSam Leffler  * configuration. The contents of buf is printed out has hex dump.
8739beb93cSSam Leffler  */
885b9c547cSRui Paulo void wpa_hexdump(int level, const char *title, const void *buf, size_t len);
8939beb93cSSam Leffler 
9039beb93cSSam Leffler static inline void wpa_hexdump_buf(int level, const char *title,
9139beb93cSSam Leffler 				   const struct wpabuf *buf)
9239beb93cSSam Leffler {
93f05cddf9SRui Paulo 	wpa_hexdump(level, title, buf ? wpabuf_head(buf) : NULL,
94f05cddf9SRui Paulo 		    buf ? wpabuf_len(buf) : 0);
9539beb93cSSam Leffler }
9639beb93cSSam Leffler 
9739beb93cSSam Leffler /**
9839beb93cSSam Leffler  * wpa_hexdump_key - conditional hex dump, hide keys
9939beb93cSSam Leffler  * @level: priority level (MSG_*) of the message
10039beb93cSSam Leffler  * @title: title of for the message
10139beb93cSSam Leffler  * @buf: data buffer to be dumped
10239beb93cSSam Leffler  * @len: length of the buf
10339beb93cSSam Leffler  *
10439beb93cSSam Leffler  * This function is used to print conditional debugging and error messages. The
10539beb93cSSam Leffler  * output may be directed to stdout, stderr, and/or syslog based on
10639beb93cSSam Leffler  * configuration. The contents of buf is printed out has hex dump. This works
10739beb93cSSam Leffler  * like wpa_hexdump(), but by default, does not include secret keys (passwords,
10839beb93cSSam Leffler  * etc.) in debug output.
10939beb93cSSam Leffler  */
1105b9c547cSRui Paulo void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len);
11139beb93cSSam Leffler 
11239beb93cSSam Leffler static inline void wpa_hexdump_buf_key(int level, const char *title,
11339beb93cSSam Leffler 				       const struct wpabuf *buf)
11439beb93cSSam Leffler {
115f05cddf9SRui Paulo 	wpa_hexdump_key(level, title, buf ? wpabuf_head(buf) : NULL,
116f05cddf9SRui Paulo 			buf ? wpabuf_len(buf) : 0);
11739beb93cSSam Leffler }
11839beb93cSSam Leffler 
11939beb93cSSam Leffler /**
12039beb93cSSam Leffler  * wpa_hexdump_ascii - conditional hex dump
12139beb93cSSam Leffler  * @level: priority level (MSG_*) of the message
12239beb93cSSam Leffler  * @title: title of for the message
12339beb93cSSam Leffler  * @buf: data buffer to be dumped
12439beb93cSSam Leffler  * @len: length of the buf
12539beb93cSSam Leffler  *
12639beb93cSSam Leffler  * This function is used to print conditional debugging and error messages. The
12739beb93cSSam Leffler  * output may be directed to stdout, stderr, and/or syslog based on
12839beb93cSSam Leffler  * configuration. The contents of buf is printed out has hex dump with both
12939beb93cSSam Leffler  * the hex numbers and ASCII characters (for printable range) are shown. 16
13039beb93cSSam Leffler  * bytes per line will be shown.
13139beb93cSSam Leffler  */
1325b9c547cSRui Paulo void wpa_hexdump_ascii(int level, const char *title, const void *buf,
13339beb93cSSam Leffler 		       size_t len);
13439beb93cSSam Leffler 
13539beb93cSSam Leffler /**
13639beb93cSSam Leffler  * wpa_hexdump_ascii_key - conditional hex dump, hide keys
13739beb93cSSam Leffler  * @level: priority level (MSG_*) of the message
13839beb93cSSam Leffler  * @title: title of for the message
13939beb93cSSam Leffler  * @buf: data buffer to be dumped
14039beb93cSSam Leffler  * @len: length of the buf
14139beb93cSSam Leffler  *
14239beb93cSSam Leffler  * This function is used to print conditional debugging and error messages. The
14339beb93cSSam Leffler  * output may be directed to stdout, stderr, and/or syslog based on
14439beb93cSSam Leffler  * configuration. The contents of buf is printed out has hex dump with both
14539beb93cSSam Leffler  * the hex numbers and ASCII characters (for printable range) are shown. 16
14639beb93cSSam Leffler  * bytes per line will be shown. This works like wpa_hexdump_ascii(), but by
14739beb93cSSam Leffler  * default, does not include secret keys (passwords, etc.) in debug output.
14839beb93cSSam Leffler  */
1495b9c547cSRui Paulo void wpa_hexdump_ascii_key(int level, const char *title, const void *buf,
15039beb93cSSam Leffler 			   size_t len);
15139beb93cSSam Leffler 
152f05cddf9SRui Paulo /*
153f05cddf9SRui Paulo  * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
154f05cddf9SRui Paulo  * binary size. As such, it should be used with debugging messages that are not
155f05cddf9SRui Paulo  * needed in the control interface while wpa_msg() has to be used for anything
156f05cddf9SRui Paulo  * that needs to shown to control interface monitors.
157f05cddf9SRui Paulo  */
158f05cddf9SRui Paulo #define wpa_dbg(args...) wpa_msg(args)
159f05cddf9SRui Paulo 
16039beb93cSSam Leffler #endif /* CONFIG_NO_STDOUT_DEBUG */
16139beb93cSSam Leffler 
16239beb93cSSam Leffler 
16339beb93cSSam Leffler #ifdef CONFIG_NO_WPA_MSG
16439beb93cSSam Leffler #define wpa_msg(args...) do { } while (0)
1653157ba21SRui Paulo #define wpa_msg_ctrl(args...) do { } while (0)
1665b9c547cSRui Paulo #define wpa_msg_global(args...) do { } while (0)
1675b9c547cSRui Paulo #define wpa_msg_global_ctrl(args...) do { } while (0)
1685b9c547cSRui Paulo #define wpa_msg_no_global(args...) do { } while (0)
169325151a3SRui Paulo #define wpa_msg_global_only(args...) do { } while (0)
17039beb93cSSam Leffler #define wpa_msg_register_cb(f) do { } while (0)
171f05cddf9SRui Paulo #define wpa_msg_register_ifname_cb(f) do { } while (0)
17239beb93cSSam Leffler #else /* CONFIG_NO_WPA_MSG */
17339beb93cSSam Leffler /**
17439beb93cSSam Leffler  * wpa_msg - Conditional printf for default target and ctrl_iface monitors
17539beb93cSSam Leffler  * @ctx: Pointer to context data; this is the ctx variable registered
17639beb93cSSam Leffler  *	with struct wpa_driver_ops::init()
17739beb93cSSam Leffler  * @level: priority level (MSG_*) of the message
17839beb93cSSam Leffler  * @fmt: printf format string, followed by optional arguments
17939beb93cSSam Leffler  *
18039beb93cSSam Leffler  * This function is used to print conditional debugging and error messages. The
18139beb93cSSam Leffler  * output may be directed to stdout, stderr, and/or syslog based on
18239beb93cSSam Leffler  * configuration. This function is like wpa_printf(), but it also sends the
18339beb93cSSam Leffler  * same message to all attached ctrl_iface monitors.
18439beb93cSSam Leffler  *
18539beb93cSSam Leffler  * Note: New line '\n' is added to the end of the text when printing to stdout.
18639beb93cSSam Leffler  */
1873157ba21SRui Paulo void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4);
1883157ba21SRui Paulo 
1893157ba21SRui Paulo /**
1903157ba21SRui Paulo  * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
1913157ba21SRui Paulo  * @ctx: Pointer to context data; this is the ctx variable registered
1923157ba21SRui Paulo  *	with struct wpa_driver_ops::init()
1933157ba21SRui Paulo  * @level: priority level (MSG_*) of the message
1943157ba21SRui Paulo  * @fmt: printf format string, followed by optional arguments
1953157ba21SRui Paulo  *
1963157ba21SRui Paulo  * This function is used to print conditional debugging and error messages.
1973157ba21SRui Paulo  * This function is like wpa_msg(), but it sends the output only to the
1983157ba21SRui Paulo  * attached ctrl_iface monitors. In other words, it can be used for frequent
1993157ba21SRui Paulo  * events that do not need to be sent to syslog.
2003157ba21SRui Paulo  */
2013157ba21SRui Paulo void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
2023157ba21SRui Paulo PRINTF_FORMAT(3, 4);
20339beb93cSSam Leffler 
2045b9c547cSRui Paulo /**
2055b9c547cSRui Paulo  * wpa_msg_global - Global printf for ctrl_iface monitors
2065b9c547cSRui Paulo  * @ctx: Pointer to context data; this is the ctx variable registered
2075b9c547cSRui Paulo  *	with struct wpa_driver_ops::init()
2085b9c547cSRui Paulo  * @level: priority level (MSG_*) of the message
2095b9c547cSRui Paulo  * @fmt: printf format string, followed by optional arguments
2105b9c547cSRui Paulo  *
2115b9c547cSRui Paulo  * This function is used to print conditional debugging and error messages.
2125b9c547cSRui Paulo  * This function is like wpa_msg(), but it sends the output as a global event,
2135b9c547cSRui Paulo  * i.e., without being specific to an interface. For backwards compatibility,
2145b9c547cSRui Paulo  * an old style event is also delivered on one of the interfaces (the one
2155b9c547cSRui Paulo  * specified by the context data).
2165b9c547cSRui Paulo  */
2175b9c547cSRui Paulo void wpa_msg_global(void *ctx, int level, const char *fmt, ...)
2185b9c547cSRui Paulo PRINTF_FORMAT(3, 4);
2195b9c547cSRui Paulo 
2205b9c547cSRui Paulo /**
2215b9c547cSRui Paulo  * wpa_msg_global_ctrl - Conditional global printf for ctrl_iface monitors
2225b9c547cSRui Paulo  * @ctx: Pointer to context data; this is the ctx variable registered
2235b9c547cSRui Paulo  *	with struct wpa_driver_ops::init()
2245b9c547cSRui Paulo  * @level: priority level (MSG_*) of the message
2255b9c547cSRui Paulo  * @fmt: printf format string, followed by optional arguments
2265b9c547cSRui Paulo  *
2275b9c547cSRui Paulo  * This function is used to print conditional debugging and error messages.
2285b9c547cSRui Paulo  * This function is like wpa_msg_global(), but it sends the output only to the
2295b9c547cSRui Paulo  * attached global ctrl_iface monitors. In other words, it can be used for
2305b9c547cSRui Paulo  * frequent events that do not need to be sent to syslog.
2315b9c547cSRui Paulo  */
2325b9c547cSRui Paulo void wpa_msg_global_ctrl(void *ctx, int level, const char *fmt, ...)
2335b9c547cSRui Paulo PRINTF_FORMAT(3, 4);
2345b9c547cSRui Paulo 
2355b9c547cSRui Paulo /**
2365b9c547cSRui Paulo  * wpa_msg_no_global - Conditional printf for ctrl_iface monitors
2375b9c547cSRui Paulo  * @ctx: Pointer to context data; this is the ctx variable registered
2385b9c547cSRui Paulo  *	with struct wpa_driver_ops::init()
2395b9c547cSRui Paulo  * @level: priority level (MSG_*) of the message
2405b9c547cSRui Paulo  * @fmt: printf format string, followed by optional arguments
2415b9c547cSRui Paulo  *
2425b9c547cSRui Paulo  * This function is used to print conditional debugging and error messages.
2435b9c547cSRui Paulo  * This function is like wpa_msg(), but it does not send the output as a global
2445b9c547cSRui Paulo  * event.
2455b9c547cSRui Paulo  */
2465b9c547cSRui Paulo void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
2475b9c547cSRui Paulo PRINTF_FORMAT(3, 4);
2485b9c547cSRui Paulo 
249325151a3SRui Paulo /**
250325151a3SRui Paulo  * wpa_msg_global_only - Conditional printf for ctrl_iface monitors
251325151a3SRui Paulo  * @ctx: Pointer to context data; this is the ctx variable registered
252325151a3SRui Paulo  *	with struct wpa_driver_ops::init()
253325151a3SRui Paulo  * @level: priority level (MSG_*) of the message
254325151a3SRui Paulo  * @fmt: printf format string, followed by optional arguments
255325151a3SRui Paulo  *
256325151a3SRui Paulo  * This function is used to print conditional debugging and error messages.
257325151a3SRui Paulo  * This function is like wpa_msg_global(), but it sends the output only as a
258325151a3SRui Paulo  * global event.
259325151a3SRui Paulo  */
260325151a3SRui Paulo void wpa_msg_global_only(void *ctx, int level, const char *fmt, ...)
261325151a3SRui Paulo PRINTF_FORMAT(3, 4);
262325151a3SRui Paulo 
263325151a3SRui Paulo enum wpa_msg_type {
264325151a3SRui Paulo 	WPA_MSG_PER_INTERFACE,
265325151a3SRui Paulo 	WPA_MSG_GLOBAL,
266325151a3SRui Paulo 	WPA_MSG_NO_GLOBAL,
267325151a3SRui Paulo 	WPA_MSG_ONLY_GLOBAL,
268325151a3SRui Paulo };
269325151a3SRui Paulo 
270325151a3SRui Paulo typedef void (*wpa_msg_cb_func)(void *ctx, int level, enum wpa_msg_type type,
2715b9c547cSRui Paulo 				const char *txt, size_t len);
27239beb93cSSam Leffler 
27339beb93cSSam Leffler /**
27439beb93cSSam Leffler  * wpa_msg_register_cb - Register callback function for wpa_msg() messages
27539beb93cSSam Leffler  * @func: Callback function (%NULL to unregister)
27639beb93cSSam Leffler  */
27739beb93cSSam Leffler void wpa_msg_register_cb(wpa_msg_cb_func func);
27839beb93cSSam Leffler 
279f05cddf9SRui Paulo typedef const char * (*wpa_msg_get_ifname_func)(void *ctx);
280f05cddf9SRui Paulo void wpa_msg_register_ifname_cb(wpa_msg_get_ifname_func func);
281f05cddf9SRui Paulo 
282f05cddf9SRui Paulo #endif /* CONFIG_NO_WPA_MSG */
28339beb93cSSam Leffler 
28439beb93cSSam Leffler #ifdef CONFIG_NO_HOSTAPD_LOGGER
28539beb93cSSam Leffler #define hostapd_logger(args...) do { } while (0)
28639beb93cSSam Leffler #define hostapd_logger_register_cb(f) do { } while (0)
28739beb93cSSam Leffler #else /* CONFIG_NO_HOSTAPD_LOGGER */
28839beb93cSSam Leffler void hostapd_logger(void *ctx, const u8 *addr, unsigned int module, int level,
28939beb93cSSam Leffler 		    const char *fmt, ...) PRINTF_FORMAT(5, 6);
29039beb93cSSam Leffler 
29139beb93cSSam Leffler typedef void (*hostapd_logger_cb_func)(void *ctx, const u8 *addr,
29239beb93cSSam Leffler 				       unsigned int module, int level,
29339beb93cSSam Leffler 				       const char *txt, size_t len);
29439beb93cSSam Leffler 
29539beb93cSSam Leffler /**
29639beb93cSSam Leffler  * hostapd_logger_register_cb - Register callback function for hostapd_logger()
29739beb93cSSam Leffler  * @func: Callback function (%NULL to unregister)
29839beb93cSSam Leffler  */
29939beb93cSSam Leffler void hostapd_logger_register_cb(hostapd_logger_cb_func func);
30039beb93cSSam Leffler #endif /* CONFIG_NO_HOSTAPD_LOGGER */
30139beb93cSSam Leffler 
30239beb93cSSam Leffler #define HOSTAPD_MODULE_IEEE80211	0x00000001
30339beb93cSSam Leffler #define HOSTAPD_MODULE_IEEE8021X	0x00000002
30439beb93cSSam Leffler #define HOSTAPD_MODULE_RADIUS		0x00000004
30539beb93cSSam Leffler #define HOSTAPD_MODULE_WPA		0x00000008
30639beb93cSSam Leffler #define HOSTAPD_MODULE_DRIVER		0x00000010
30739beb93cSSam Leffler #define HOSTAPD_MODULE_MLME		0x00000040
30839beb93cSSam Leffler 
30939beb93cSSam Leffler enum hostapd_logger_level {
31039beb93cSSam Leffler 	HOSTAPD_LEVEL_DEBUG_VERBOSE = 0,
31139beb93cSSam Leffler 	HOSTAPD_LEVEL_DEBUG = 1,
31239beb93cSSam Leffler 	HOSTAPD_LEVEL_INFO = 2,
31339beb93cSSam Leffler 	HOSTAPD_LEVEL_NOTICE = 3,
31439beb93cSSam Leffler 	HOSTAPD_LEVEL_WARNING = 4
31539beb93cSSam Leffler };
31639beb93cSSam Leffler 
31739beb93cSSam Leffler 
318e28a4053SRui Paulo #ifdef CONFIG_DEBUG_SYSLOG
319e28a4053SRui Paulo 
320e28a4053SRui Paulo void wpa_debug_open_syslog(void);
321e28a4053SRui Paulo void wpa_debug_close_syslog(void);
322e28a4053SRui Paulo 
323e28a4053SRui Paulo #else /* CONFIG_DEBUG_SYSLOG */
324e28a4053SRui Paulo 
325e28a4053SRui Paulo static inline void wpa_debug_open_syslog(void)
326e28a4053SRui Paulo {
327e28a4053SRui Paulo }
328e28a4053SRui Paulo 
329e28a4053SRui Paulo static inline void wpa_debug_close_syslog(void)
330e28a4053SRui Paulo {
331e28a4053SRui Paulo }
332e28a4053SRui Paulo 
333e28a4053SRui Paulo #endif /* CONFIG_DEBUG_SYSLOG */
334e28a4053SRui Paulo 
335f05cddf9SRui Paulo #ifdef CONFIG_DEBUG_LINUX_TRACING
336f05cddf9SRui Paulo 
337f05cddf9SRui Paulo int wpa_debug_open_linux_tracing(void);
338f05cddf9SRui Paulo void wpa_debug_close_linux_tracing(void);
339f05cddf9SRui Paulo 
340f05cddf9SRui Paulo #else /* CONFIG_DEBUG_LINUX_TRACING */
341f05cddf9SRui Paulo 
342f05cddf9SRui Paulo static inline int wpa_debug_open_linux_tracing(void)
343f05cddf9SRui Paulo {
344f05cddf9SRui Paulo 	return 0;
345f05cddf9SRui Paulo }
346f05cddf9SRui Paulo 
347f05cddf9SRui Paulo static inline void wpa_debug_close_linux_tracing(void)
348f05cddf9SRui Paulo {
349f05cddf9SRui Paulo }
350f05cddf9SRui Paulo 
351f05cddf9SRui Paulo #endif /* CONFIG_DEBUG_LINUX_TRACING */
352f05cddf9SRui Paulo 
35339beb93cSSam Leffler 
35439beb93cSSam Leffler #ifdef EAPOL_TEST
35539beb93cSSam Leffler #define WPA_ASSERT(a)						       \
35639beb93cSSam Leffler 	do {							       \
35739beb93cSSam Leffler 		if (!(a)) {					       \
35839beb93cSSam Leffler 			printf("WPA_ASSERT FAILED '" #a "' "	       \
35939beb93cSSam Leffler 			       "%s %s:%d\n",			       \
36039beb93cSSam Leffler 			       __FUNCTION__, __FILE__, __LINE__);      \
36139beb93cSSam Leffler 			exit(1);				       \
36239beb93cSSam Leffler 		}						       \
36339beb93cSSam Leffler 	} while (0)
36439beb93cSSam Leffler #else
36539beb93cSSam Leffler #define WPA_ASSERT(a) do { } while (0)
36639beb93cSSam Leffler #endif
36739beb93cSSam Leffler 
368325151a3SRui Paulo const char * debug_level_str(int level);
369325151a3SRui Paulo int str_to_debug_level(const char *s);
370325151a3SRui Paulo 
37139beb93cSSam Leffler #endif /* WPA_DEBUG_H */
372