Convert wpa_hexdump functions to use void pointer instead of u8 *

This removes need for ugly typecasts for some debug prints.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-12-24 23:12:37 +02:00
parent 5f9c134ab4
commit 35c200624e
2 changed files with 11 additions and 10 deletions

View file

@ -375,19 +375,19 @@ static void _wpa_hexdump(int level, const char *title, const u8 *buf,
#endif /* CONFIG_ANDROID_LOG */ #endif /* CONFIG_ANDROID_LOG */
} }
void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len) void wpa_hexdump(int level, const char *title, const void *buf, size_t len)
{ {
_wpa_hexdump(level, title, buf, len, 1); _wpa_hexdump(level, title, buf, len, 1);
} }
void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len) void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len)
{ {
_wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys);
} }
static void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf, static void _wpa_hexdump_ascii(int level, const char *title, const void *buf,
size_t len, int show) size_t len, int show)
{ {
size_t i, llen; size_t i, llen;
@ -407,7 +407,7 @@ static void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf,
/* can do ascii processing in userspace */ /* can do ascii processing in userspace */
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
fprintf(wpa_debug_tracing_file, fprintf(wpa_debug_tracing_file,
" %02x", buf[i]); " %02x", pos[i]);
} }
fflush(wpa_debug_tracing_file); fflush(wpa_debug_tracing_file);
} }
@ -495,13 +495,14 @@ static void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf,
} }
void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, size_t len) void wpa_hexdump_ascii(int level, const char *title, const void *buf,
size_t len)
{ {
_wpa_hexdump_ascii(level, title, buf, len, 1); _wpa_hexdump_ascii(level, title, buf, len, 1);
} }
void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, void wpa_hexdump_ascii_key(int level, const char *title, const void *buf,
size_t len) size_t len)
{ {
_wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys);

View file

@ -77,7 +77,7 @@ PRINTF_FORMAT(2, 3);
* output may be directed to stdout, stderr, and/or syslog based on * output may be directed to stdout, stderr, and/or syslog based on
* configuration. The contents of buf is printed out has hex dump. * configuration. The contents of buf is printed out has hex dump.
*/ */
void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len); void wpa_hexdump(int level, const char *title, const void *buf, size_t len);
static inline void wpa_hexdump_buf(int level, const char *title, static inline void wpa_hexdump_buf(int level, const char *title,
const struct wpabuf *buf) const struct wpabuf *buf)
@ -99,7 +99,7 @@ static inline void wpa_hexdump_buf(int level, const char *title,
* like wpa_hexdump(), but by default, does not include secret keys (passwords, * like wpa_hexdump(), but by default, does not include secret keys (passwords,
* etc.) in debug output. * etc.) in debug output.
*/ */
void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len); void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len);
static inline void wpa_hexdump_buf_key(int level, const char *title, static inline void wpa_hexdump_buf_key(int level, const char *title,
const struct wpabuf *buf) const struct wpabuf *buf)
@ -121,7 +121,7 @@ static inline void wpa_hexdump_buf_key(int level, const char *title,
* the hex numbers and ASCII characters (for printable range) are shown. 16 * the hex numbers and ASCII characters (for printable range) are shown. 16
* bytes per line will be shown. * bytes per line will be shown.
*/ */
void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, void wpa_hexdump_ascii(int level, const char *title, const void *buf,
size_t len); size_t len);
/** /**
@ -138,7 +138,7 @@ void wpa_hexdump_ascii(int level, const char *title, const u8 *buf,
* bytes per line will be shown. This works like wpa_hexdump_ascii(), but by * 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. * default, does not include secret keys (passwords, etc.) in debug output.
*/ */
void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, void wpa_hexdump_ascii_key(int level, const char *title, const void *buf,
size_t len); size_t len);
/* /*