Document the wpa_msg_cb "global" parameter

Instead of an int variable with magic values 0, 1, 2, use an enum that
gives clearer meaning to the values now that the original boolean type
global argument is not really a boolean anymore.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-02-06 12:08:28 +02:00 committed by Jouni Malinen
parent e66bcedd3e
commit 995a3a06f4
6 changed files with 26 additions and 17 deletions

View file

@ -635,7 +635,7 @@ void wpa_msg(void *ctx, int level, const char *fmt, ...)
va_end(ap);
wpa_printf(level, "%s%s", prefix, buf);
if (wpa_msg_cb)
wpa_msg_cb(ctx, level, 0, buf, len);
wpa_msg_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len);
os_free(buf);
}
@ -663,7 +663,7 @@ void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
va_start(ap, fmt);
len = vsnprintf(buf, buflen, fmt, ap);
va_end(ap);
wpa_msg_cb(ctx, level, 0, buf, len);
wpa_msg_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len);
os_free(buf);
}
@ -690,7 +690,7 @@ void wpa_msg_global(void *ctx, int level, const char *fmt, ...)
va_end(ap);
wpa_printf(level, "%s", buf);
if (wpa_msg_cb)
wpa_msg_cb(ctx, level, 1, buf, len);
wpa_msg_cb(ctx, level, WPA_MSG_GLOBAL, buf, len);
os_free(buf);
}
@ -718,7 +718,7 @@ void wpa_msg_global_ctrl(void *ctx, int level, const char *fmt, ...)
va_start(ap, fmt);
len = vsnprintf(buf, buflen, fmt, ap);
va_end(ap);
wpa_msg_cb(ctx, level, 1, buf, len);
wpa_msg_cb(ctx, level, WPA_MSG_GLOBAL, buf, len);
os_free(buf);
}
@ -745,7 +745,7 @@ void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
va_end(ap);
wpa_printf(level, "%s", buf);
if (wpa_msg_cb)
wpa_msg_cb(ctx, level, 2, buf, len);
wpa_msg_cb(ctx, level, WPA_MSG_NO_GLOBAL, buf, len);
os_free(buf);
}

View file

@ -243,7 +243,13 @@ PRINTF_FORMAT(3, 4);
void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
PRINTF_FORMAT(3, 4);
typedef void (*wpa_msg_cb_func)(void *ctx, int level, int global,
enum wpa_msg_type {
WPA_MSG_PER_INTERFACE,
WPA_MSG_GLOBAL,
WPA_MSG_NO_GLOBAL,
};
typedef void (*wpa_msg_cb_func)(void *ctx, int level, enum wpa_msg_type type,
const char *txt, size_t len);
/**