wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Typedefs | Enumerations | Functions | Variables
wpa_debug.h File Reference

wpa_supplicant/hostapd / Debug prints More...

#include "wpabuf.h"

Go to the source code of this file.

Macros

#define wpa_dbg(args...)   wpa_msg(args)
 
#define HOSTAPD_MODULE_IEEE80211   0x00000001
 
#define HOSTAPD_MODULE_IEEE8021X   0x00000002
 
#define HOSTAPD_MODULE_RADIUS   0x00000004
 
#define HOSTAPD_MODULE_WPA   0x00000008
 
#define HOSTAPD_MODULE_DRIVER   0x00000010
 
#define HOSTAPD_MODULE_IAPP   0x00000020
 
#define HOSTAPD_MODULE_MLME   0x00000040
 
#define WPA_ASSERT(a)   do { } while (0)
 

Typedefs

typedef void(* wpa_msg_cb_func )(void *ctx, int level, enum wpa_msg_type type, const char *txt, size_t len)
 
typedef const char *(* wpa_msg_get_ifname_func )(void *ctx)
 

Enumerations

enum  {
  MSG_EXCESSIVE, MSG_MSGDUMP, MSG_DEBUG, MSG_INFO,
  MSG_WARNING, MSG_ERROR
}
 
enum  wpa_msg_type { WPA_MSG_PER_INTERFACE, WPA_MSG_GLOBAL, WPA_MSG_NO_GLOBAL, WPA_MSG_ONLY_GLOBAL }
 
enum  hostapd_logger_level {
  HOSTAPD_LEVEL_DEBUG_VERBOSE = 0, HOSTAPD_LEVEL_DEBUG = 1, HOSTAPD_LEVEL_INFO = 2, HOSTAPD_LEVEL_NOTICE = 3,
  HOSTAPD_LEVEL_WARNING = 4
}
 

Functions

int wpa_debug_open_file (const char *path)
 
int wpa_debug_reopen_file (void)
 
void wpa_debug_close_file (void)
 
void wpa_debug_setup_stdout (void)
 
void wpa_debug_print_timestamp (void)
 Print timestamp for debug output. More...
 
void wpa_printf (int level, const char *fmt,...) PRINTF_FORMAT(2
 conditional printf More...
 
void void wpa_hexdump (int level, const char *title, const void *buf, size_t len)
 conditional hex dump More...
 
void wpa_hexdump_key (int level, const char *title, const void *buf, size_t len)
 conditional hex dump, hide keys More...
 
void wpa_hexdump_ascii (int level, const char *title, const void *buf, size_t len)
 conditional hex dump More...
 
void wpa_hexdump_ascii_key (int level, const char *title, const void *buf, size_t len)
 conditional hex dump, hide keys More...
 
void wpa_msg (void *ctx, int level, const char *fmt,...) PRINTF_FORMAT(3
 Conditional printf for default target and ctrl_iface monitors. More...
 
void void wpa_msg_ctrl (void *ctx, int level, const char *fmt,...) PRINTF_FORMAT(3
 Conditional printf for ctrl_iface monitors. More...
 
void void void wpa_msg_global (void *ctx, int level, const char *fmt,...) PRINTF_FORMAT(3
 Global printf for ctrl_iface monitors. More...
 
void void void void wpa_msg_global_ctrl (void *ctx, int level, const char *fmt,...) PRINTF_FORMAT(3
 Conditional global printf for ctrl_iface monitors. More...
 
void void void void void wpa_msg_no_global (void *ctx, int level, const char *fmt,...) PRINTF_FORMAT(3
 Conditional printf for ctrl_iface monitors. More...
 
void void void void void void wpa_msg_global_only (void *ctx, int level, const char *fmt,...) PRINTF_FORMAT(3
 Conditional printf for ctrl_iface monitors. More...
 
void wpa_msg_register_cb (wpa_msg_cb_func func)
 Register callback function for wpa_msg() messages. More...
 
void wpa_msg_register_ifname_cb (wpa_msg_get_ifname_func func)
 
void hostapd_logger (void *ctx, const u8 *addr, unsigned int module, int level, const char *fmt,...) PRINTF_FORMAT(5
 
void hostapd_logger_register_cb (hostapd_logger_cb_func func)
 Register callback function for hostapd_logger() More...
 
const char * debug_level_str (int level)
 
int str_to_debug_level (const char *s)
 

Variables

void typedef void(* hostapd_logger_cb_func )(void *ctx, const u8 *addr, unsigned int module, int level, const char *txt, size_t len)
 
int wpa_debug_level
 
int wpa_debug_show_keys
 
int wpa_debug_timestamp
 

Detailed Description

wpa_supplicant/hostapd / Debug prints

Function Documentation

void hostapd_logger_register_cb ( hostapd_logger_cb_func  func)

Register callback function for hostapd_logger()

Parameters
funcCallback function (NULL to unregister)
void wpa_debug_print_timestamp ( void  )

Print timestamp for debug output.

This function prints a timestamp in seconds_from_1970.microsoconds format if debug output has been configured to include timestamps in debug messages.

void void wpa_hexdump ( int  level,
const char *  title,
const void *  buf,
size_t  len 
)

conditional hex dump

Parameters
levelpriority level (MSG_*) of the message
titletitle of for the message
bufdata buffer to be dumped
lenlength of the buf

This function is used to print conditional debugging and error messages. The output may be directed to stdout, stderr, and/or syslog based on configuration. The contents of buf is printed out has hex dump.

void wpa_hexdump_ascii ( int  level,
const char *  title,
const void *  buf,
size_t  len 
)

conditional hex dump

Parameters
levelpriority level (MSG_*) of the message
titletitle of for the message
bufdata buffer to be dumped
lenlength of the buf

This function is used to print conditional debugging and error messages. The output may be directed to stdout, stderr, and/or syslog based on configuration. The contents of buf is printed out has hex dump with both the hex numbers and ASCII characters (for printable range) are shown. 16 bytes per line will be shown.

void wpa_hexdump_ascii_key ( int  level,
const char *  title,
const void *  buf,
size_t  len 
)

conditional hex dump, hide keys

Parameters
levelpriority level (MSG_*) of the message
titletitle of for the message
bufdata buffer to be dumped
lenlength of the buf

This function is used to print conditional debugging and error messages. The output may be directed to stdout, stderr, and/or syslog based on configuration. The contents of buf is printed out has hex dump with both the hex numbers and ASCII characters (for printable range) are shown. 16 bytes per line will be shown. This works like wpa_hexdump_ascii(), but by default, does not include secret keys (passwords, etc.) in debug output.

void wpa_hexdump_key ( int  level,
const char *  title,
const void *  buf,
size_t  len 
)

conditional hex dump, hide keys

Parameters
levelpriority level (MSG_*) of the message
titletitle of for the message
bufdata buffer to be dumped
lenlength of the buf

This function is used to print conditional debugging and error messages. The output may be directed to stdout, stderr, and/or syslog based on configuration. The contents of buf is printed out has hex dump. This works like wpa_hexdump(), but by default, does not include secret keys (passwords, etc.) in debug output.

void wpa_msg ( void *  ctx,
int  level,
const char *  fmt,
  ... 
)

Conditional printf for default target and ctrl_iface monitors.

Parameters
ctxPointer to context data; this is the ctx variable registered with struct wpa_driver_ops::init()
levelpriority level (MSG_*) of the message
fmtprintf format string, followed by optional arguments

This function is used to print conditional debugging and error messages. The output may be directed to stdout, stderr, and/or syslog based on configuration. This function is like wpa_printf(), but it also sends the same message to all attached ctrl_iface monitors.

Note: New line '
' is added to the end of the text when printing to stdout.

void void wpa_msg_ctrl ( void *  ctx,
int  level,
const char *  fmt,
  ... 
)

Conditional printf for ctrl_iface monitors.

Parameters
ctxPointer to context data; this is the ctx variable registered with struct wpa_driver_ops::init()
levelpriority level (MSG_*) of the message
fmtprintf format string, followed by optional arguments

This function is used to print conditional debugging and error messages. This function is like wpa_msg(), but it sends the output only to the attached ctrl_iface monitors. In other words, it can be used for frequent events that do not need to be sent to syslog.

void void void wpa_msg_global ( void *  ctx,
int  level,
const char *  fmt,
  ... 
)

Global printf for ctrl_iface monitors.

Parameters
ctxPointer to context data; this is the ctx variable registered with struct wpa_driver_ops::init()
levelpriority level (MSG_*) of the message
fmtprintf format string, followed by optional arguments

This function is used to print conditional debugging and error messages. This function is like wpa_msg(), but it sends the output as a global event, i.e., without being specific to an interface. For backwards compatibility, an old style event is also delivered on one of the interfaces (the one specified by the context data).

void void void void wpa_msg_global_ctrl ( void *  ctx,
int  level,
const char *  fmt,
  ... 
)

Conditional global printf for ctrl_iface monitors.

Parameters
ctxPointer to context data; this is the ctx variable registered with struct wpa_driver_ops::init()
levelpriority level (MSG_*) of the message
fmtprintf format string, followed by optional arguments

This function is used to print conditional debugging and error messages. This function is like wpa_msg_global(), but it sends the output only to the attached global ctrl_iface monitors. In other words, it can be used for frequent events that do not need to be sent to syslog.

void void void void void void wpa_msg_global_only ( void *  ctx,
int  level,
const char *  fmt,
  ... 
)

Conditional printf for ctrl_iface monitors.

Parameters
ctxPointer to context data; this is the ctx variable registered with struct wpa_driver_ops::init()
levelpriority level (MSG_*) of the message
fmtprintf format string, followed by optional arguments

This function is used to print conditional debugging and error messages. This function is like wpa_msg_global(), but it sends the output only as a global event.

void void void void void wpa_msg_no_global ( void *  ctx,
int  level,
const char *  fmt,
  ... 
)

Conditional printf for ctrl_iface monitors.

Parameters
ctxPointer to context data; this is the ctx variable registered with struct wpa_driver_ops::init()
levelpriority level (MSG_*) of the message
fmtprintf format string, followed by optional arguments

This function is used to print conditional debugging and error messages. This function is like wpa_msg(), but it does not send the output as a global event.

void wpa_msg_register_cb ( wpa_msg_cb_func  func)

Register callback function for wpa_msg() messages.

Parameters
funcCallback function (NULL to unregister)
void wpa_printf ( int  level,
const char *  fmt,
  ... 
)

conditional printf

Parameters
levelpriority level (MSG_*) of the message
fmtprintf format string, followed by optional arguments

This function is used to print conditional debugging and error messages. The output may be directed to stdout, stderr, and/or syslog based on configuration.

Note: New line '
' is added to the end of the text when printing to stdout.