wpa_debug.h

Go to the documentation of this file.
00001 
00016 #ifndef WPA_DEBUG_H
00017 #define WPA_DEBUG_H
00018 
00019 #include "wpabuf.h"
00020 
00021 /* Debugging function - conditional printf and hex dump. Driver wrappers can
00022  * use these for debugging purposes. */
00023 
00024 enum { MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR };
00025 
00026 #ifdef CONFIG_NO_STDOUT_DEBUG
00027 
00028 #define wpa_debug_print_timestamp() do { } while (0)
00029 #define wpa_printf(args...) do { } while (0)
00030 #define wpa_hexdump(l,t,b,le) do { } while (0)
00031 #define wpa_hexdump_buf(l,t,b) do { } while (0)
00032 #define wpa_hexdump_key(l,t,b,le) do { } while (0)
00033 #define wpa_hexdump_buf_key(l,t,b) do { } while (0)
00034 #define wpa_hexdump_ascii(l,t,b,le) do { } while (0)
00035 #define wpa_hexdump_ascii_key(l,t,b,le) do { } while (0)
00036 #define wpa_debug_open_file(p) do { } while (0)
00037 #define wpa_debug_close_file() do { } while (0)
00038 
00039 #else /* CONFIG_NO_STDOUT_DEBUG */
00040 
00041 int wpa_debug_open_file(const char *path);
00042 void wpa_debug_close_file(void);
00043 
00052 void wpa_debug_print_timestamp(void);
00053 
00066 void wpa_printf(int level, char *fmt, ...)
00067 PRINTF_FORMAT(2, 3);
00068 
00081 void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len);
00082 
00083 static inline void wpa_hexdump_buf(int level, const char *title,
00084                                    const struct wpabuf *buf)
00085 {
00086         wpa_hexdump(level, title, wpabuf_head(buf), wpabuf_len(buf));
00087 }
00088 
00103 void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len);
00104 
00105 static inline void wpa_hexdump_buf_key(int level, const char *title,
00106                                        const struct wpabuf *buf)
00107 {
00108         wpa_hexdump_key(level, title, wpabuf_head(buf), wpabuf_len(buf));
00109 }
00110 
00125 void wpa_hexdump_ascii(int level, const char *title, const u8 *buf,
00126                        size_t len);
00127 
00143 void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf,
00144                            size_t len);
00145 
00146 #endif /* CONFIG_NO_STDOUT_DEBUG */
00147 
00148 
00149 #ifdef CONFIG_NO_WPA_MSG
00150 #define wpa_msg(args...) do { } while (0)
00151 #define wpa_msg_ctrl(args...) do { } while (0)
00152 #define wpa_msg_register_cb(f) do { } while (0)
00153 #else /* CONFIG_NO_WPA_MSG */
00154 
00169 void wpa_msg(void *ctx, int level, char *fmt, ...) PRINTF_FORMAT(3, 4);
00170 
00184 void wpa_msg_ctrl(void *ctx, int level, char *fmt, ...) PRINTF_FORMAT(3, 4);
00185 
00186 typedef void (*wpa_msg_cb_func)(void *ctx, int level, const char *txt,
00187                                 size_t len);
00188 
00194 void wpa_msg_register_cb(wpa_msg_cb_func func);
00195 #endif /* CONFIG_NO_WPA_MSG */
00196 
00197 
00198 #ifdef CONFIG_NO_HOSTAPD_LOGGER
00199 #define hostapd_logger(args...) do { } while (0)
00200 #define hostapd_logger_register_cb(f) do { } while (0)
00201 #else /* CONFIG_NO_HOSTAPD_LOGGER */
00202 void hostapd_logger(void *ctx, const u8 *addr, unsigned int module, int level,
00203                     const char *fmt, ...) PRINTF_FORMAT(5, 6);
00204 
00205 typedef void (*hostapd_logger_cb_func)(void *ctx, const u8 *addr,
00206                                        unsigned int module, int level,
00207                                        const char *txt, size_t len);
00208 
00214 void hostapd_logger_register_cb(hostapd_logger_cb_func func);
00215 #endif /* CONFIG_NO_HOSTAPD_LOGGER */
00216 
00217 #define HOSTAPD_MODULE_IEEE80211        0x00000001
00218 #define HOSTAPD_MODULE_IEEE8021X        0x00000002
00219 #define HOSTAPD_MODULE_RADIUS           0x00000004
00220 #define HOSTAPD_MODULE_WPA              0x00000008
00221 #define HOSTAPD_MODULE_DRIVER           0x00000010
00222 #define HOSTAPD_MODULE_IAPP             0x00000020
00223 #define HOSTAPD_MODULE_MLME             0x00000040
00224 
00225 enum hostapd_logger_level {
00226         HOSTAPD_LEVEL_DEBUG_VERBOSE = 0,
00227         HOSTAPD_LEVEL_DEBUG = 1,
00228         HOSTAPD_LEVEL_INFO = 2,
00229         HOSTAPD_LEVEL_NOTICE = 3,
00230         HOSTAPD_LEVEL_WARNING = 4
00231 };
00232 
00233 
00234 #ifdef CONFIG_DEBUG_SYSLOG
00235 
00236 void wpa_debug_open_syslog(void);
00237 void wpa_debug_close_syslog(void);
00238 
00239 #else /* CONFIG_DEBUG_SYSLOG */
00240 
00241 static inline void wpa_debug_open_syslog(void)
00242 {
00243 }
00244 
00245 static inline void wpa_debug_close_syslog(void)
00246 {
00247 }
00248 
00249 #endif /* CONFIG_DEBUG_SYSLOG */
00250 
00251 
00252 #ifdef EAPOL_TEST
00253 #define WPA_ASSERT(a)                                                  \
00254         do {                                                           \
00255                 if (!(a)) {                                            \
00256                         printf("WPA_ASSERT FAILED '" #a "' "           \
00257                                "%s %s:%d\n",                           \
00258                                __FUNCTION__, __FILE__, __LINE__);      \
00259                         exit(1);                                       \
00260                 }                                                      \
00261         } while (0)
00262 #else
00263 #define WPA_ASSERT(a) do { } while (0)
00264 #endif
00265 
00266 #endif /* WPA_DEBUG_H */
00267 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Sat Nov 21 23:16:54 2009 for hostapd by  doxygen 1.6.1