D-Bus: Add AutoScan interface method to set/unset autoscan parameters

Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2012-06-26 19:05:09 +03:00 committed by Jouni Malinen
parent 7c865c6853
commit 67892d5c0d
4 changed files with 74 additions and 0 deletions

View file

@ -316,6 +316,22 @@ fi.w1.wpa_supplicant1.CreateInterface.
<dd>A blob with the specified name doesn't exist.</dd> <dd>A blob with the specified name doesn't exist.</dd>
</dl> </dl>
</li> </li>
<li>
<h3>AutoScan ( s : arg ) --> nothing</h3>
<p>Set autoscan parameters for the interface.</p>
<h4>Arguments</h4>
<dl>
<dt>s : arg</dt>
<dd>Autoscan parameter line or empty to unset autoscan.</dd>
</dl>
<h4>Possible errors</h4>
<dl>
<dt>fi.w1.wpa_supplicant1.NoMemory</dt>
<dd>Needed memory was not possible to get allocated.</dd>
<dt>fi.w1.wpa_supplicant1.InvalidArgs</dt>
<dd>Invalid entries were found in the passed argument.</dd>
</dl>
</li>
</ul> </ul>
\subsection dbus_interface_properties Properties \subsection dbus_interface_properties Properties

View file

@ -1920,6 +1920,15 @@ static const struct wpa_dbus_method_desc wpas_dbus_global_methods[] = {
END_ARGS 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 } } { NULL, NULL, NULL, { END_ARGS } }
}; };

View file

@ -1811,6 +1811,52 @@ DBusMessage * wpas_dbus_handler_flush_bss(DBusMessage *message,
} }
#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 (arg != NULL && os_strlen(arg) > 0) {
char *tmp;
tmp = os_strdup(arg);
if (tmp == NULL) {
reply = dbus_message_new_error(message,
DBUS_ERROR_NO_MEMORY,
NULL);
} else {
os_free(wpa_s->conf->autoscan);
wpa_s->conf->autoscan = tmp;
if (state == WPA_DISCONNECTED || state == WPA_INACTIVE)
autoscan_init(wpa_s);
}
} else if (arg != NULL && os_strlen(arg) == 0) {
os_free(wpa_s->conf->autoscan);
wpa_s->conf->autoscan = NULL;
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 * wpas_dbus_getter_capabilities - Return interface capabilities
* @iter: Pointer to incoming dbus message iter * @iter: Pointer to incoming dbus message iter

View file

@ -124,6 +124,9 @@ DBusMessage * wpas_dbus_handler_remove_blob(DBusMessage *message,
DBusMessage * wpas_dbus_handler_flush_bss(DBusMessage *message, DBusMessage * wpas_dbus_handler_flush_bss(DBusMessage *message,
struct wpa_supplicant *wpa_s); struct wpa_supplicant *wpa_s);
DBusMessage * wpas_dbus_handler_autoscan(DBusMessage *message,
struct wpa_supplicant *wpa_s);
dbus_bool_t wpas_dbus_getter_capabilities(DBusMessageIter *iter, dbus_bool_t wpas_dbus_getter_capabilities(DBusMessageIter *iter,
DBusError *error, void *user_data); DBusError *error, void *user_data);