aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2015-08-17 13:12:03 +0530
committerSrinivas Dasari <dasaris@codeaurora.org>2015-10-27 15:26:31 +0530
commitbe10fca4de6ea6516c95c5aa0909cdbb67e15fbe (patch)
tree2df64ba09638f6d132ae014f8de16f3d87133e82 /src
parent2c2fb0b85d7fef10a2827a64724e79583c70995a (diff)
downloadandroid_external_wpa_supplicant_8-be10fca4de6ea6516c95c5aa0909cdbb67e15fbe.tar.gz
android_external_wpa_supplicant_8-be10fca4de6ea6516c95c5aa0909cdbb67e15fbe.tar.bz2
android_external_wpa_supplicant_8-be10fca4de6ea6516c95c5aa0909cdbb67e15fbe.zip
Move debug level string conversion functions to wpa_debug.c
This makes it possible to use these helper functions from hostapd as well as the current use in wpa_supplicant CRs-Fixed: 891515 Git-repo: git://w1.fi/srv/git/hostap.git Git-commit: ab62f96f55ebdda69a8fd173980c181adce0a1bf Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Change-Id: Icc4e48bf211ee67b7d732dfacc875afaba4a2209
Diffstat (limited to 'src')
-rw-r--r--src/utils/wpa_debug.c39
-rw-r--r--src/utils/wpa_debug.h3
2 files changed, 42 insertions, 0 deletions
diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c
index 3c263016..61c0d5ce 100644
--- a/src/utils/wpa_debug.c
+++ b/src/utils/wpa_debug.c
@@ -819,3 +819,42 @@ void hostapd_logger(void *ctx, const u8 *addr, unsigned int module, int level,
bin_clear_free(buf, buflen);
}
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
+
+
+const char * debug_level_str(int level)
+{
+ switch (level) {
+ case MSG_EXCESSIVE:
+ return "EXCESSIVE";
+ case MSG_MSGDUMP:
+ return "MSGDUMP";
+ case MSG_DEBUG:
+ return "DEBUG";
+ case MSG_INFO:
+ return "INFO";
+ case MSG_WARNING:
+ return "WARNING";
+ case MSG_ERROR:
+ return "ERROR";
+ default:
+ return "?";
+ }
+}
+
+
+int str_to_debug_level(const char *s)
+{
+ if (os_strcasecmp(s, "EXCESSIVE") == 0)
+ return MSG_EXCESSIVE;
+ if (os_strcasecmp(s, "MSGDUMP") == 0)
+ return MSG_MSGDUMP;
+ if (os_strcasecmp(s, "DEBUG") == 0)
+ return MSG_DEBUG;
+ if (os_strcasecmp(s, "INFO") == 0)
+ return MSG_INFO;
+ if (os_strcasecmp(s, "WARNING") == 0)
+ return MSG_WARNING;
+ if (os_strcasecmp(s, "ERROR") == 0)
+ return MSG_ERROR;
+ return -1;
+}
diff --git a/src/utils/wpa_debug.h b/src/utils/wpa_debug.h
index 87bd7fad..17d8f963 100644
--- a/src/utils/wpa_debug.h
+++ b/src/utils/wpa_debug.h
@@ -364,4 +364,7 @@ static inline void wpa_debug_close_linux_tracing(void)
#define WPA_ASSERT(a) do { } while (0)
#endif
+const char * debug_level_str(int level);
+int str_to_debug_level(const char *s);
+
#endif /* WPA_DEBUG_H */