From 87d3c628353bbcd00a779db68a50a8d20842ffdd Mon Sep 17 00:00:00 2001 From: Nishant Chaprana Date: Tue, 26 May 2015 09:38:39 +0530 Subject: [PATCH] WPS: Add WPS Cancel method over D-Bus interface Signed-off-by: Nishant Chaprana --- doc/dbus.doxygen | 4 ++++ wpa_supplicant/dbus/dbus_new.c | 6 ++++++ wpa_supplicant/dbus/dbus_new_handlers.h | 3 +++ wpa_supplicant/dbus/dbus_new_handlers_wps.c | 20 ++++++++++++++++++++ 4 files changed, 33 insertions(+) diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index d623116d1..7ad975920 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -877,6 +877,10 @@ Interface for performing WPS (Wi-Fi Simple Config) operations.
Invalid entries were found in the passed argument.
+
  • +

    Cancel ( nothing ) --> nothing

    +

    Cancel ongoing WPS operation.

    +
  • \subsection dbus_wps_properties Properties diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 840d1050a..85039bc71 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -2583,6 +2583,12 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = { END_ARGS } }, + { "Cancel", WPAS_DBUS_NEW_IFACE_WPS, + (WPADBusMethodHandler) wpas_dbus_handler_wps_cancel, + { + END_ARGS + } + }, #endif /* CONFIG_WPS */ #ifdef CONFIG_P2P { "Find", WPAS_DBUS_NEW_IFACE_P2PDEVICE, diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h index 6113db500..9afdc0597 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.h +++ b/wpa_supplicant/dbus/dbus_new_handlers.h @@ -291,6 +291,9 @@ dbus_bool_t wpas_dbus_setter_network_properties(DBusMessageIter *iter, DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message, struct wpa_supplicant *wpa_s); +DBusMessage * wpas_dbus_handler_wps_cancel(DBusMessage *message, + struct wpa_supplicant *wpa_s); + dbus_bool_t wpas_dbus_getter_process_credentials(DBusMessageIter *iter, DBusError *error, void *user_data); diff --git a/wpa_supplicant/dbus/dbus_new_handlers_wps.c b/wpa_supplicant/dbus/dbus_new_handlers_wps.c index 734ac4a1c..dcae0a913 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_wps.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_wps.c @@ -319,6 +319,26 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message, } +/** + * wpas_dbus_handler_wps_cancel - Cancel ongoing WPS configuration + * @message: Pointer to incoming dbus message + * @wpa_s: %wpa_supplicant data structure + * Returns: NULL on success or DBus error on failure + * + * Handler for "Cancel" method call. Returns NULL if WPS cancel successfull + * or DBus error on WPS cancel failure + */ +DBusMessage * wpas_dbus_handler_wps_cancel(DBusMessage *message, + struct wpa_supplicant *wpa_s) +{ + if (wpas_wps_cancel(wpa_s)) + return wpas_dbus_error_unknown_error(message, + "WPS cancel failed"); + + return NULL; +} + + /** * wpas_dbus_getter_process_credentials - Check if credentials are processed * @message: Pointer to incoming dbus message