[PATCHv2] wpa_supplicant: add DBus method for changing debug parameters
Helmut Schaa
helmut.schaa
Mon Mar 30 03:22:26 PDT 2009
Add a new DBus method "setDebugParams" which takes the parameters
debug_level, debug_timestamp and show_keys as input and updates the
internal debug variables accordingly.
To change the debug level, enable/disable timestamps and enable/disable
show_keys the following dbus-send command can be used:
dbus-send --system --dest=fi.epitest.hostap.WPASupplicant --print-reply
/fi/epitest/hostap/WPASupplicant fi.epitest.hostap.WPASupplicant.setDebugParams
int32:0 boolean:false boolean:false
Signed-off-by: Helmut Schaa <helmut.schaa at googlemail.com>
---
diff --git a/wpa_supplicant/ctrl_iface_dbus.c b/wpa_supplicant/ctrl_iface_dbus.c
index c4e329c..7048d75 100644
--- a/wpa_supplicant/ctrl_iface_dbus.c
+++ b/wpa_supplicant/ctrl_iface_dbus.c
@@ -603,6 +603,9 @@ static DBusHandlerResult wpas_message_handler(DBusConnection *connection,
} else if (!strcmp(method, "getInterface")) {
reply = wpas_dbus_global_get_interface(
message, ctrl_iface->global);
+ } else if (!strcmp(method, "setDebugParams")) {
+ reply = wpas_dbus_global_set_debugparams(
+ message, ctrl_iface->global);
}
}
diff --git a/wpa_supplicant/ctrl_iface_dbus_handlers.c b/wpa_supplicant/ctrl_iface_dbus_handlers.c
index 161f7f8..e21c35c 100644
--- a/wpa_supplicant/ctrl_iface_dbus_handlers.c
+++ b/wpa_supplicant/ctrl_iface_dbus_handlers.c
@@ -25,6 +25,9 @@
#include "wpas_glue.h"
#include "eapol_supp/eapol_supp_sm.h"
+extern int wpa_debug_level;
+extern int wpa_debug_show_keys;
+extern int wpa_debug_timestamp;
/**
* wpas_dbus_new_invalid_opts_error - Return a new invalid options error message
@@ -277,6 +280,51 @@ out:
return reply;
}
+/**
+ * wpas_dbus_global_set_debugparams- Set the debug params
+ * @message: Pointer to incoming dbus message
+ * @global: %wpa_supplicant global data structure
+ * Returns: a dbus message containing a UINT32 indicating success (1) or
+ * failure (0), or returns a dbus error message with more information
+ *
+ * Handler function for "setDebugParams" method call. Handles requests
+ * by dbus clients for the object path of an specific network interface.
+ */
+DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
+ struct wpa_global *global)
+{
+ DBusMessage *reply = NULL;
+ int debug_level;
+ dbus_bool_t debug_timestamp;
+ dbus_bool_t debug_show_keys;
+
+ if (!dbus_message_get_args(message, NULL,
+ DBUS_TYPE_INT32, &debug_level,
+ DBUS_TYPE_BOOLEAN, &debug_timestamp,
+ DBUS_TYPE_BOOLEAN, &debug_show_keys,
+ DBUS_TYPE_INVALID)) {
+ reply = wpas_dbus_new_invalid_opts_error(message, NULL);
+ goto out;
+ }
+
+ /* check for allowed debuglevels */
+ if (debug_level != MSG_MSGDUMP &&
+ debug_level != MSG_DEBUG &&
+ debug_level != MSG_INFO &&
+ debug_level != MSG_WARNING &&
+ debug_level != MSG_ERROR) {
+ reply = wpas_dbus_new_invalid_opts_error(message, NULL);
+ goto out;
+ }
+
+ wpa_debug_level = debug_level;
+ wpa_debug_timestamp = debug_timestamp ? 1 : 0;
+ wpa_debug_show_keys = debug_show_keys ? 1 : 0;
+ reply = wpas_dbus_new_success_reply(message);
+
+out:
+ return reply;
+}
/**
* wpas_dbus_iface_scan - Request a wireless scan on an interface
diff --git a/wpa_supplicant/ctrl_iface_dbus_handlers.h b/wpa_supplicant/ctrl_iface_dbus_handlers.h
index 9660f95..65fa721 100644
--- a/wpa_supplicant/ctrl_iface_dbus_handlers.h
+++ b/wpa_supplicant/ctrl_iface_dbus_handlers.h
@@ -28,6 +28,9 @@ DBusMessage * wpas_dbus_global_remove_interface(DBusMessage *message,
DBusMessage * wpas_dbus_global_get_interface(DBusMessage *message,
struct wpa_global *global);
+DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
+ struct wpa_global *global);
+
DBusMessage * wpas_dbus_iface_scan(DBusMessage *message,
struct wpa_supplicant *wpa_s);
More information about the Hostap
mailing list