From patchwork Tue Jun 26 08:05:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Bursztyka X-Patchwork-Id: 167329 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 052431007DA for ; Tue, 26 Jun 2012 18:07:05 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id E87469D20F; Tue, 26 Jun 2012 04:06:59 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ym40+tR+C6S9; Tue, 26 Jun 2012 04:06:59 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 366B79D210; Tue, 26 Jun 2012 04:06:24 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BFEBB9D26F for ; Tue, 26 Jun 2012 04:06:22 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k6yyGUV+lPvM for ; Tue, 26 Jun 2012 04:06:19 -0400 (EDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 41E2A9D210 for ; Tue, 26 Jun 2012 04:06:14 -0400 (EDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 26 Jun 2012 01:06:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,351,1309762800"; d="scan'208";a="162733308" Received: from mriya.fi.intel.com ([10.237.68.149]) by orsmga002.jf.intel.com with ESMTP; 26 Jun 2012 01:06:06 -0700 From: Tomasz Bursztyka To: hostap@lists.shmoo.com Subject: [PATCH 3/7] Adding AutoScan interface method to set or unset autoscan parameters Date: Tue, 26 Jun 2012 11:05:48 +0300 Message-Id: <1340697952-4209-4-git-send-email-tomasz.bursztyka@linux.intel.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1340697952-4209-1-git-send-email-tomasz.bursztyka@linux.intel.com> References: <1340697952-4209-1-git-send-email-tomasz.bursztyka@linux.intel.com> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Signed-hostap: Tomasz Bursztyka --- doc/dbus.doxygen | 16 +++++++++++ wpa_supplicant/dbus/dbus_new.c | 9 ++++++ wpa_supplicant/dbus/dbus_new_handlers.c | 44 +++++++++++++++++++++++++++++++ wpa_supplicant/dbus/dbus_new_handlers.h | 5 +++ 4 files changed, 74 insertions(+), 0 deletions(-) diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index b298dd8..478dcc5 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -316,6 +316,22 @@ fi.w1.wpa_supplicant1.CreateInterface.
A blob with the specified name doesn't exist.
+
  • +

    AutoScan ( s : arg ) --> nothing

    +

    Set autoscan parameters for the interface.

    +

    Arguments

    +
    +
    s : arg
    +
    Autoscan parameter line or empty to unset autoscan.
    +
    +

    Possible errors

    +
    +
    fi.w1.wpa_supplicant1.NoMemory
    +
    Needed memory was not possible to get allocated.
    +
    fi.w1.wpa_supplicant1.InvalidArgs
    +
    Invalid entries were found in the passed argument.
    +
    +
  • \subsection dbus_interface_properties Properties diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index f7393d9..a8e87d5 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -1920,6 +1920,15 @@ static const struct wpa_dbus_method_desc wpas_dbus_global_methods[] = { END_ARGS } }, +#ifdef CONFIG_AUTOSCAN + { "AutoScan", WPAS_DBUS_NEW_IFACE_INTERFACE, + (WPADBusMethodHandler) &wpas_dbus_handler_autoscan, + { + { "arg", "s", ARG_IN }, + END_ARGS + } + }, +#endif /* CONFIG_AUTOSCAN */ { NULL, NULL, NULL, { END_ARGS } } }; diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index 1c7592d..2d2c6dd 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -1810,6 +1810,50 @@ DBusMessage * wpas_dbus_handler_flush_bss(DBusMessage *message, return NULL; } +#ifdef CONFIG_AUTOSCAN +/** + * wpas_dbus_handler_autoscan - Set autoscan parameters for the interface + * @message: Pointer to incoming dbus message + * @wpa_s: wpa_supplicant structure for a network interface + * Returns: NULL + * + * Handler function for "AutoScan" method call of network interface. + */ +DBusMessage * wpas_dbus_handler_autoscan(DBusMessage *message, + struct wpa_supplicant *wpa_s) +{ + DBusMessage *reply = NULL; + enum wpa_states state = wpa_s->wpa_state; + char *arg; + + dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg, + DBUS_TYPE_INVALID); + + if (wpa_s->conf->autoscan != NULL) { + os_free(wpa_s->conf->autoscan); + wpa_s->conf->autoscan = NULL; + } + + if (arg != NULL && os_strlen(arg) > 0) { + wpa_s->conf->autoscan = os_strdup(arg); + if (wpa_s->conf->autoscan == NULL) { + reply = dbus_message_new_error(message, + DBUS_ERROR_NO_MEMORY, + NULL); + } + + if (state == WPA_DISCONNECTED || state == WPA_INACTIVE) + autoscan_init(wpa_s); + } else if (os_strlen(arg) == 0) + autoscan_deinit(wpa_s); + else + reply = dbus_message_new_error(message, + DBUS_ERROR_INVALID_ARGS, + NULL); + + return reply; +} +#endif /* CONFIG_AUTOSCAN */ /** * wpas_dbus_getter_capabilities - Return interface capabilities diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h index d78aa20..c8b8a94 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.h +++ b/wpa_supplicant/dbus/dbus_new_handlers.h @@ -124,6 +124,11 @@ DBusMessage * wpas_dbus_handler_remove_blob(DBusMessage *message, DBusMessage * wpas_dbus_handler_flush_bss(DBusMessage *message, struct wpa_supplicant *wpa_s); +#ifdef CONFIG_AUTOSCAN +DBusMessage * wpas_dbus_handler_autoscan(DBusMessage *message, + struct wpa_supplicant *wpa_s); +#endif /* CONFIG_AUTOSCAN */ + dbus_bool_t wpas_dbus_getter_capabilities(DBusMessageIter *iter, DBusError *error, void *user_data);