2009-11-09 22:51:59 +01:00
|
|
|
/*
|
|
|
|
* WPA Supplicant / dbus-based control interface
|
|
|
|
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
2010-01-09 10:40:15 +01:00
|
|
|
* Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
|
2009-12-28 00:10:07 +01:00
|
|
|
* Copyright (c) 2009, Jouni Malinen <j@w1.fi>
|
2009-11-09 22:51:59 +01:00
|
|
|
*
|
2012-07-02 11:04:38 +02:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2009-11-09 22:51:59 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
2011-06-13 00:08:19 +02:00
|
|
|
#include "common/ieee802_11_defs.h"
|
2009-11-09 22:51:59 +01:00
|
|
|
#include "wps/wps.h"
|
2018-10-07 14:31:51 +02:00
|
|
|
#include "ap/sta_info.h"
|
2009-12-20 20:11:35 +01:00
|
|
|
#include "../config.h"
|
|
|
|
#include "../wpa_supplicant_i.h"
|
2009-12-28 00:10:07 +01:00
|
|
|
#include "../bss.h"
|
2011-10-24 18:03:04 +02:00
|
|
|
#include "../wpas_glue.h"
|
2009-12-20 20:11:35 +01:00
|
|
|
#include "dbus_new_helpers.h"
|
2009-11-09 22:51:59 +01:00
|
|
|
#include "dbus_dict_helpers.h"
|
2009-12-20 20:11:35 +01:00
|
|
|
#include "dbus_new.h"
|
|
|
|
#include "dbus_new_handlers.h"
|
2009-12-30 23:15:56 +01:00
|
|
|
#include "dbus_common_i.h"
|
2011-06-13 00:08:19 +02:00
|
|
|
#include "dbus_new_handlers_p2p.h"
|
|
|
|
#include "p2p/p2p.h"
|
2014-06-02 16:42:08 +02:00
|
|
|
#include "../p2p_supplicant.h"
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2012-04-01 20:13:38 +02:00
|
|
|
#ifdef CONFIG_AP /* until needed by something else */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NameOwnerChanged handling
|
|
|
|
*
|
|
|
|
* Some services we provide allow an application to register for
|
|
|
|
* a signal that it needs. While it can also unregister, we must
|
|
|
|
* be prepared for the case where the application simply crashes
|
|
|
|
* and thus doesn't clean up properly. The way to handle this in
|
|
|
|
* DBus is to register for the NameOwnerChanged signal which will
|
|
|
|
* signal an owner change to NULL if the peer closes the socket
|
|
|
|
* for whatever reason.
|
|
|
|
*
|
|
|
|
* Handle this signal via a filter function whenever necessary.
|
|
|
|
* The code below also handles refcounting in case in the future
|
|
|
|
* there will be multiple instances of this subscription scheme.
|
|
|
|
*/
|
|
|
|
static const char wpas_dbus_noc_filter_str[] =
|
|
|
|
"interface=org.freedesktop.DBus,member=NameOwnerChanged";
|
|
|
|
|
|
|
|
|
|
|
|
static DBusHandlerResult noc_filter(DBusConnection *conn,
|
|
|
|
DBusMessage *message, void *data)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *priv = data;
|
|
|
|
|
|
|
|
if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_SIGNAL)
|
|
|
|
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
|
|
|
|
|
|
|
if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS,
|
|
|
|
"NameOwnerChanged")) {
|
|
|
|
const char *name;
|
|
|
|
const char *prev_owner;
|
|
|
|
const char *new_owner;
|
|
|
|
DBusError derr;
|
|
|
|
struct wpa_supplicant *wpa_s;
|
|
|
|
|
|
|
|
dbus_error_init(&derr);
|
|
|
|
|
|
|
|
if (!dbus_message_get_args(message, &derr,
|
|
|
|
DBUS_TYPE_STRING, &name,
|
|
|
|
DBUS_TYPE_STRING, &prev_owner,
|
|
|
|
DBUS_TYPE_STRING, &new_owner,
|
|
|
|
DBUS_TYPE_INVALID)) {
|
|
|
|
/* Ignore this error */
|
|
|
|
dbus_error_free(&derr);
|
|
|
|
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
|
|
|
}
|
|
|
|
|
2014-12-31 22:21:10 +01:00
|
|
|
for (wpa_s = priv->global->ifaces; wpa_s; wpa_s = wpa_s->next) {
|
2012-04-01 20:13:38 +02:00
|
|
|
if (wpa_s->preq_notify_peer != NULL &&
|
|
|
|
os_strcmp(name, wpa_s->preq_notify_peer) == 0 &&
|
|
|
|
(new_owner == NULL || os_strlen(new_owner) == 0)) {
|
|
|
|
/* probe request owner disconnected */
|
|
|
|
os_free(wpa_s->preq_notify_peer);
|
|
|
|
wpa_s->preq_notify_peer = NULL;
|
|
|
|
wpas_dbus_unsubscribe_noc(priv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wpas_dbus_subscribe_noc(struct wpas_dbus_priv *priv)
|
|
|
|
{
|
|
|
|
priv->dbus_noc_refcnt++;
|
|
|
|
if (priv->dbus_noc_refcnt > 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!dbus_connection_add_filter(priv->con, noc_filter, priv, NULL)) {
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: failed to add filter");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dbus_bus_add_match(priv->con, wpas_dbus_noc_filter_str, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wpas_dbus_unsubscribe_noc(struct wpas_dbus_priv *priv)
|
|
|
|
{
|
|
|
|
priv->dbus_noc_refcnt--;
|
|
|
|
if (priv->dbus_noc_refcnt > 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_bus_remove_match(priv->con, wpas_dbus_noc_filter_str, NULL);
|
|
|
|
dbus_connection_remove_filter(priv->con, noc_filter, priv);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_AP */
|
|
|
|
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_interface - Send a interface related event signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @sig_name: signal name - InterfaceAdded or InterfaceRemoved
|
2010-01-02 11:06:44 +01:00
|
|
|
* @properties: Whether to add second argument with object properties
|
2009-11-09 22:51:59 +01:00
|
|
|
*
|
|
|
|
* Notify listeners about event related with interface
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_interface(struct wpa_supplicant *wpa_s,
|
2018-10-07 14:31:50 +02:00
|
|
|
const char *sig_name,
|
|
|
|
dbus_bool_t properties)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2011-07-29 20:25:39 +02:00
|
|
|
DBusMessageIter iter;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(WPAS_DBUS_NEW_PATH,
|
|
|
|
WPAS_DBUS_NEW_INTERFACE, sig_name);
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
2010-01-01 11:47:59 +01:00
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2010-01-01 18:12:31 +01:00
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
2014-12-31 12:57:48 +01:00
|
|
|
&wpa_s->dbus_new_path) ||
|
|
|
|
(properties &&
|
|
|
|
!wpa_dbus_get_object_properties(
|
|
|
|
iface, wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE, &iter)))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-01-01 11:49:27 +01:00
|
|
|
* wpas_dbus_signal_interface_added - Send a interface created signal
|
2009-11-09 22:51:59 +01:00
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
*
|
|
|
|
* Notify listeners about creating new interface
|
|
|
|
*/
|
2010-01-01 11:49:27 +01:00
|
|
|
static void wpas_dbus_signal_interface_added(struct wpa_supplicant *wpa_s)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2010-01-01 11:49:27 +01:00
|
|
|
wpas_dbus_signal_interface(wpa_s, "InterfaceAdded", TRUE);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_interface_removed - Send a interface removed signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
*
|
|
|
|
* Notify listeners about removing interface
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_interface_removed(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
2010-01-01 11:47:59 +01:00
|
|
|
wpas_dbus_signal_interface(wpa_s, "InterfaceRemoved", FALSE);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_scan_done - send scan done signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @success: indicates if scanning succeed or failed
|
|
|
|
*
|
|
|
|
* Notify listeners about finishing a scan
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2009-11-09 22:51:59 +01:00
|
|
|
dbus_bool_t succ;
|
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
"ScanDone");
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
succ = success ? TRUE : FALSE;
|
2010-01-02 11:06:44 +01:00
|
|
|
if (dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &succ,
|
|
|
|
DBUS_TYPE_INVALID))
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
else
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2014-12-31 12:57:48 +01:00
|
|
|
* wpas_dbus_signal_bss - Send a BSS related event signal
|
2009-11-09 22:51:59 +01:00
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @bss_obj_path: BSS object path
|
|
|
|
* @sig_name: signal name - BSSAdded or BSSRemoved
|
2010-01-02 11:06:44 +01:00
|
|
|
* @properties: Whether to add second argument with object properties
|
2009-11-09 22:51:59 +01:00
|
|
|
*
|
|
|
|
* Notify listeners about event related with BSS
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_bss(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *bss_obj_path,
|
2018-10-07 14:31:50 +02:00
|
|
|
const char *sig_name, dbus_bool_t properties)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2011-07-29 20:25:39 +02:00
|
|
|
DBusMessageIter iter;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
sig_name);
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
2010-01-01 11:47:59 +01:00
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2010-01-01 11:47:59 +01:00
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
2014-12-31 12:57:48 +01:00
|
|
|
&bss_obj_path) ||
|
|
|
|
(properties &&
|
|
|
|
!wpa_dbus_get_object_properties(iface, bss_obj_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_BSS,
|
|
|
|
&iter)))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_bss_added - Send a BSS added signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @bss_obj_path: new BSS object path
|
|
|
|
*
|
|
|
|
* Notify listeners about adding new BSS
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_bss_added(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *bss_obj_path)
|
|
|
|
{
|
2010-01-01 11:47:59 +01:00
|
|
|
wpas_dbus_signal_bss(wpa_s, bss_obj_path, "BSSAdded", TRUE);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_bss_removed - Send a BSS removed signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @bss_obj_path: BSS object path
|
|
|
|
*
|
|
|
|
* Notify listeners about removing BSS
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_bss_removed(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *bss_obj_path)
|
|
|
|
{
|
2010-01-01 11:47:59 +01:00
|
|
|
wpas_dbus_signal_bss(wpa_s, bss_obj_path, "BSSRemoved", FALSE);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_blob - Send a blob related event signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @name: blob name
|
|
|
|
* @sig_name: signal name - BlobAdded or BlobRemoved
|
|
|
|
*
|
|
|
|
* Notify listeners about event related with blob
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_blob(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *name, const char *sig_name)
|
|
|
|
{
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
sig_name);
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &name,
|
|
|
|
DBUS_TYPE_INVALID))
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
else
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_blob_added - Send a blob added signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @name: blob name
|
|
|
|
*
|
|
|
|
* Notify listeners about adding a new blob
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *name)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
|
|
|
wpas_dbus_signal_blob(wpa_s, name, "BlobAdded");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_blob_removed - Send a blob removed signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @name: blob name
|
|
|
|
*
|
|
|
|
* Notify listeners about removing blob
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *name)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
|
|
|
wpas_dbus_signal_blob(wpa_s, name, "BlobRemoved");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_network - Send a network related event signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @id: new network id
|
|
|
|
* @sig_name: signal name - NetworkAdded, NetworkRemoved or NetworkSelected
|
2010-01-01 11:47:59 +01:00
|
|
|
* @properties: determines if add second argument with object properties
|
2009-11-09 22:51:59 +01:00
|
|
|
*
|
|
|
|
* Notify listeners about event related with configured network
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_network(struct wpa_supplicant *wpa_s,
|
2010-01-01 11:47:59 +01:00
|
|
|
int id, const char *sig_name,
|
2018-10-07 14:31:50 +02:00
|
|
|
dbus_bool_t properties)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2011-07-29 20:25:39 +02:00
|
|
|
DBusMessageIter iter;
|
2010-01-02 11:06:44 +01:00
|
|
|
char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
2010-01-01 18:12:31 +01:00
|
|
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, id);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
sig_name);
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
2010-01-01 11:47:59 +01:00
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
path = net_obj_path;
|
2010-01-01 11:47:59 +01:00
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
2014-12-31 12:57:48 +01:00
|
|
|
&path) ||
|
|
|
|
(properties &&
|
|
|
|
!wpa_dbus_get_object_properties(
|
|
|
|
iface, net_obj_path, WPAS_DBUS_NEW_IFACE_NETWORK,
|
|
|
|
&iter)))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_network_added - Send a network added signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @id: new network id
|
|
|
|
*
|
|
|
|
* Notify listeners about adding new network
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_network_added(struct wpa_supplicant *wpa_s,
|
|
|
|
int id)
|
|
|
|
{
|
2010-01-01 11:47:59 +01:00
|
|
|
wpas_dbus_signal_network(wpa_s, id, "NetworkAdded", TRUE);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-11-14 14:57:02 +01:00
|
|
|
* wpas_dbus_signal_network_removed - Send a network removed signal
|
2009-11-09 22:51:59 +01:00
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @id: network id
|
|
|
|
*
|
|
|
|
* Notify listeners about removing a network
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_network_removed(struct wpa_supplicant *wpa_s,
|
|
|
|
int id)
|
|
|
|
{
|
2010-01-01 11:47:59 +01:00
|
|
|
wpas_dbus_signal_network(wpa_s, id, "NetworkRemoved", FALSE);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_network_selected - Send a network selected signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @id: network id
|
|
|
|
*
|
|
|
|
* Notify listeners about selecting a network
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2010-01-01 11:47:59 +01:00
|
|
|
wpas_dbus_signal_network(wpa_s, id, "NetworkSelected", FALSE);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-24 18:03:04 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_network_request - Indicate that additional information
|
|
|
|
* (EAP password, etc.) is required to complete the association to this SSID
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @rtype: The specific additional information required
|
|
|
|
* @default_text: Optional description of required information
|
|
|
|
*
|
|
|
|
* Request additional information or passwords to complete an association
|
|
|
|
* request.
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_network_request(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_ssid *ssid,
|
|
|
|
enum wpa_ctrl_req_type rtype,
|
|
|
|
const char *default_txt)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter;
|
|
|
|
char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
const char *field, *txt = NULL, *net_ptr;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2011-10-24 18:03:04 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
field = wpa_supplicant_ctrl_req_to_string(rtype, default_txt, &txt);
|
|
|
|
if (field == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
"NetworkRequest");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, ssid->id);
|
|
|
|
net_ptr = &net_obj_path[0];
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
2014-12-31 12:57:48 +01:00
|
|
|
&net_ptr) ||
|
|
|
|
!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &field) ||
|
|
|
|
!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &txt))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2011-10-24 18:03:04 +02:00
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-09 22:51:59 +01:00
|
|
|
/**
|
2009-11-14 14:57:02 +01:00
|
|
|
* wpas_dbus_signal_network_enabled_changed - Signals Enabled property changes
|
2009-11-09 22:51:59 +01:00
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @ssid: configured network which Enabled property has changed
|
|
|
|
*
|
|
|
|
* Sends PropertyChanged signals containing new value of Enabled property
|
|
|
|
* for specified network
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_ssid *ssid)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
char path[WPAS_DBUS_OBJECT_PATH_MAX];
|
2014-12-31 22:21:10 +01:00
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
|
2010-01-01 18:12:31 +01:00
|
|
|
wpa_s->dbus_new_path, ssid->id);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2010-01-04 16:15:57 +01:00
|
|
|
wpa_dbus_mark_property_changed(wpa_s->global->dbus, path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_NETWORK, "Enabled");
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_WPS
|
|
|
|
|
2015-06-05 14:46:51 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_wps_event_pbc_overlap - Signals PBC overlap WPS event
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
*
|
|
|
|
* Sends Event dbus signal with name "pbc-overlap" and empty dict as arguments
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
char *key = "pbc-overlap";
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_WPS, "Event");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
|
|
|
|
!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-09 22:51:59 +01:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_wps_event_success - Signals Success WPS event
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
*
|
|
|
|
* Sends Event dbus signal with name "success" and empty dict as arguments
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2009-11-09 22:51:59 +01:00
|
|
|
DBusMessageIter iter, dict_iter;
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2009-11-09 22:51:59 +01:00
|
|
|
char *key = "success";
|
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_WPS, "Event");
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
|
|
|
|
!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
2010-01-02 11:06:44 +01:00
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_wps_event_fail - Signals Fail WPS event
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2015-06-16 07:06:12 +02:00
|
|
|
* @fail: WPS failure information
|
2009-11-09 22:51:59 +01:00
|
|
|
*
|
|
|
|
* Sends Event dbus signal with name "fail" and dictionary containing
|
|
|
|
* "msg field with fail message number (int32) as arguments
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wps_event_fail *fail)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2009-11-09 22:51:59 +01:00
|
|
|
DBusMessageIter iter, dict_iter;
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2009-11-14 15:02:01 +01:00
|
|
|
char *key = "fail";
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_WPS, "Event");
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
|
|
|
|
!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "msg", fail->msg) ||
|
2015-05-28 05:53:06 +02:00
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "config_error",
|
|
|
|
fail->config_error) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "error_indication",
|
|
|
|
fail->error_indication) ||
|
2010-01-02 11:06:44 +01:00
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_wps_event_m2d - Signals M2D WPS event
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2015-06-16 07:06:12 +02:00
|
|
|
* @m2d: M2D event data information
|
2009-11-09 22:51:59 +01:00
|
|
|
*
|
|
|
|
* Sends Event dbus signal with name "m2d" and dictionary containing
|
|
|
|
* fields of wps_event_m2d structure.
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wps_event_m2d *m2d)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2009-11-09 22:51:59 +01:00
|
|
|
DBusMessageIter iter, dict_iter;
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2009-11-14 15:02:01 +01:00
|
|
|
char *key = "m2d";
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_WPS, "Event");
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
|
|
|
|
!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_uint16(&dict_iter, "config_methods",
|
|
|
|
m2d->config_methods) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "manufacturer",
|
|
|
|
(const char *) m2d->manufacturer,
|
|
|
|
m2d->manufacturer_len) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "model_name",
|
|
|
|
(const char *) m2d->model_name,
|
|
|
|
m2d->model_name_len) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "model_number",
|
|
|
|
(const char *) m2d->model_number,
|
|
|
|
m2d->model_number_len) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "serial_number",
|
|
|
|
(const char *)
|
|
|
|
m2d->serial_number,
|
|
|
|
m2d->serial_number_len) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "dev_name",
|
|
|
|
(const char *) m2d->dev_name,
|
|
|
|
m2d->dev_name_len) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "primary_dev_type",
|
|
|
|
(const char *)
|
|
|
|
m2d->primary_dev_type, 8) ||
|
|
|
|
!wpa_dbus_dict_append_uint16(&dict_iter, "config_error",
|
|
|
|
m2d->config_error) ||
|
|
|
|
!wpa_dbus_dict_append_uint16(&dict_iter, "dev_password_id",
|
|
|
|
m2d->dev_password_id) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_wps_cred - Signals new credentials
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2015-06-16 07:06:12 +02:00
|
|
|
* @cred: WPS Credential information
|
2009-11-09 22:51:59 +01:00
|
|
|
*
|
|
|
|
* Sends signal with credentials in directory argument
|
|
|
|
*/
|
2010-01-01 17:45:29 +01:00
|
|
|
void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
|
|
|
const struct wps_credential *cred)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2010-01-02 11:06:44 +01:00
|
|
|
DBusMessage *msg;
|
2009-11-09 22:51:59 +01:00
|
|
|
DBusMessageIter iter, dict_iter;
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface;
|
2014-04-06 10:18:10 +02:00
|
|
|
char *auth_type[5]; /* we have five possible authentication types */
|
2009-11-09 22:51:59 +01:00
|
|
|
int at_num = 0;
|
2014-04-06 10:18:10 +02:00
|
|
|
char *encr_type[3]; /* we have three possible encryption types */
|
2009-11-09 22:51:59 +01:00
|
|
|
int et_num = 0;
|
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_WPS,
|
|
|
|
"Credentials");
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2010-01-01 19:50:12 +01:00
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
|
2009-11-09 22:51:59 +01:00
|
|
|
goto nomem;
|
|
|
|
|
|
|
|
if (cred->auth_type & WPS_AUTH_OPEN)
|
|
|
|
auth_type[at_num++] = "open";
|
|
|
|
if (cred->auth_type & WPS_AUTH_WPAPSK)
|
|
|
|
auth_type[at_num++] = "wpa-psk";
|
|
|
|
if (cred->auth_type & WPS_AUTH_WPA)
|
|
|
|
auth_type[at_num++] = "wpa-eap";
|
|
|
|
if (cred->auth_type & WPS_AUTH_WPA2)
|
|
|
|
auth_type[at_num++] = "wpa2-eap";
|
|
|
|
if (cred->auth_type & WPS_AUTH_WPA2PSK)
|
2014-04-06 10:18:10 +02:00
|
|
|
auth_type[at_num++] = "wpa2-psk";
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
if (cred->encr_type & WPS_ENCR_NONE)
|
|
|
|
encr_type[et_num++] = "none";
|
|
|
|
if (cred->encr_type & WPS_ENCR_TKIP)
|
|
|
|
encr_type[et_num++] = "tkip";
|
|
|
|
if (cred->encr_type & WPS_ENCR_AES)
|
|
|
|
encr_type[et_num++] = "aes";
|
|
|
|
|
2014-12-31 12:57:48 +01:00
|
|
|
if ((wpa_s->current_ssid &&
|
|
|
|
!wpa_dbus_dict_append_byte_array(
|
|
|
|
&dict_iter, "BSSID",
|
|
|
|
(const char *) wpa_s->current_ssid->bssid, ETH_ALEN)) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
|
2010-01-02 11:06:44 +01:00
|
|
|
(const char *) cred->ssid,
|
|
|
|
cred->ssid_len) ||
|
|
|
|
!wpa_dbus_dict_append_string_array(&dict_iter, "AuthType",
|
|
|
|
(const char **) auth_type,
|
|
|
|
at_num) ||
|
|
|
|
!wpa_dbus_dict_append_string_array(&dict_iter, "EncrType",
|
|
|
|
(const char **) encr_type,
|
|
|
|
et_num) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "Key",
|
|
|
|
(const char *) cred->key,
|
|
|
|
cred->key_len) ||
|
|
|
|
!wpa_dbus_dict_append_uint32(&dict_iter, "KeyIndex",
|
|
|
|
cred->key_idx) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
2009-11-09 22:51:59 +01:00
|
|
|
goto nomem;
|
|
|
|
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
nomem:
|
2010-01-02 11:06:44 +01:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_WPS */
|
|
|
|
|
2017-07-18 09:07:51 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_MESH
|
2017-07-18 09:07:53 +02:00
|
|
|
|
2017-07-18 09:07:51 +02:00
|
|
|
void wpas_dbus_signal_mesh_group_started(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_ssid *ssid)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (!iface || !wpa_s->dbus_new_path)
|
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_MESH,
|
|
|
|
"MeshGroupStarted");
|
|
|
|
if (!msg)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
|
|
|
|
(const char *) ssid->ssid,
|
|
|
|
ssid->ssid_len) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
2017-07-18 09:07:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
void wpas_dbus_signal_mesh_group_removed(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *meshid, u8 meshid_len,
|
|
|
|
int reason)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (!iface || !wpa_s->dbus_new_path)
|
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_MESH,
|
|
|
|
"MeshGroupRemoved");
|
|
|
|
if (!msg)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
|
|
|
|
(const char *) meshid,
|
|
|
|
meshid_len) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "DisconnectReason",
|
|
|
|
reason) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
2017-07-18 09:07:54 +02:00
|
|
|
|
|
|
|
void wpas_dbus_signal_mesh_peer_connected(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *peer_addr)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (!iface || !wpa_s->dbus_new_path)
|
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_MESH,
|
|
|
|
"MeshPeerConnected");
|
|
|
|
if (!msg)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "PeerAddress",
|
|
|
|
(const char *) peer_addr,
|
|
|
|
ETH_ALEN) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
2017-07-18 09:07:55 +02:00
|
|
|
|
|
|
|
void wpas_dbus_signal_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *peer_addr, int reason)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (!iface || !wpa_s->dbus_new_path)
|
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_MESH,
|
|
|
|
"MeshPeerDisconnected");
|
|
|
|
if (!msg)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "PeerAddress",
|
|
|
|
(const char *) peer_addr,
|
|
|
|
ETH_ALEN) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "DisconnectReason",
|
|
|
|
reason) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
2017-07-18 09:07:51 +02:00
|
|
|
#endif /* CONFIG_MESH */
|
|
|
|
|
|
|
|
|
2011-07-05 11:22:32 +02:00
|
|
|
void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
|
|
|
|
int depth, const char *subject,
|
2015-01-14 12:29:40 +01:00
|
|
|
const char *altsubject[],
|
|
|
|
int num_altsubject,
|
2011-07-05 11:22:32 +02:00
|
|
|
const char *cert_hash,
|
|
|
|
const struct wpabuf *cert)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2011-07-05 11:22:32 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
"Certification");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2014-12-31 12:57:48 +01:00
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_uint32(&dict_iter, "depth", depth) ||
|
|
|
|
!wpa_dbus_dict_append_string(&dict_iter, "subject", subject) ||
|
2015-01-14 12:29:40 +01:00
|
|
|
(altsubject && num_altsubject &&
|
|
|
|
!wpa_dbus_dict_append_string_array(&dict_iter, "altsubject",
|
|
|
|
altsubject, num_altsubject)) ||
|
2014-12-31 12:57:48 +01:00
|
|
|
(cert_hash &&
|
|
|
|
!wpa_dbus_dict_append_string(&dict_iter, "cert_hash",
|
|
|
|
cert_hash)) ||
|
|
|
|
(cert &&
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "cert",
|
|
|
|
wpabuf_head(cert),
|
|
|
|
wpabuf_len(cert))) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2011-07-05 11:22:32 +02:00
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
2012-06-04 20:10:01 +02:00
|
|
|
|
|
|
|
void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *status, const char *parameter)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2012-06-04 20:10:01 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
"EAP");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
|
2014-12-31 12:57:48 +01:00
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &status) ||
|
2012-06-04 20:10:01 +02:00
|
|
|
!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
|
|
|
|
¶meter))
|
2014-12-31 12:57:48 +01:00
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2012-06-04 20:10:01 +02:00
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-22 11:09:09 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_sta - Send a station related event signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @sta: station mac address
|
|
|
|
* @sig_name: signal name - StaAuthorized or StaDeauthorized
|
|
|
|
*
|
|
|
|
* Notify listeners about event related with station
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_sta(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *sta, const char *sig_name)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
char sta_mac[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
char *dev_mac;
|
|
|
|
|
|
|
|
os_snprintf(sta_mac, WPAS_DBUS_OBJECT_PATH_MAX, MACSTR, MAC2STR(sta));
|
|
|
|
dev_mac = sta_mac;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2013-06-22 11:09:09 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE, sig_name);
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &dev_mac,
|
|
|
|
DBUS_TYPE_INVALID))
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
else
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Station MAC address '%s' '%s'",
|
|
|
|
sta_mac, sig_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_sta_authorized - Send a STA authorized signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @sta: station mac address
|
|
|
|
*
|
|
|
|
* Notify listeners a new station has been authorized
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_sta_authorized(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *sta)
|
|
|
|
{
|
|
|
|
wpas_dbus_signal_sta(wpa_s, sta, "StaAuthorized");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_sta_deauthorized - Send a STA deauthorized signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @sta: station mac address
|
|
|
|
*
|
|
|
|
* Notify listeners a station has been deauthorized
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_sta_deauthorized(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *sta)
|
|
|
|
{
|
|
|
|
wpas_dbus_signal_sta(wpa_s, sta, "StaDeauthorized");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-10-07 14:31:51 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_station - Send an event signal related to a station object
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @station_obj_path: Station object path
|
|
|
|
* @sig_name: signal name - StationAdded or StationRemoved
|
|
|
|
* @properties: Whether to add second argument with object properties
|
|
|
|
*
|
|
|
|
* Notify listeners about event related with station.
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_station(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *station_obj_path,
|
|
|
|
const char *sig_name,
|
|
|
|
dbus_bool_t properties)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (!iface || !wpa_s->dbus_new_path)
|
|
|
|
return;
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: STA signal %s", sig_name);
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE, sig_name);
|
|
|
|
if (!msg)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
|
|
|
&station_obj_path) ||
|
|
|
|
(properties &&
|
|
|
|
!wpa_dbus_get_object_properties(iface, station_obj_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_STA,
|
|
|
|
&iter)))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_station_added - Send a Station added signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @station_obj_path: new Station object path
|
|
|
|
*
|
|
|
|
* Notify listeners about adding new Station
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_station_added(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *station_obj_path)
|
|
|
|
{
|
|
|
|
wpas_dbus_signal_station(wpa_s, station_obj_path, "StationAdded", TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_station_removed - Send a Station removed signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @station_obj_path: Station object path
|
|
|
|
*
|
|
|
|
* Notify listeners about removing Station
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_station_removed(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *station_obj_path)
|
|
|
|
{
|
|
|
|
wpas_dbus_signal_station(wpa_s, station_obj_path, "StationRemoved",
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
#ifdef CONFIG_P2P
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/**
|
2011-06-13 00:08:19 +02:00
|
|
|
* wpas_dbus_signal_p2p_group_removed - Signals P2P group was removed
|
2009-11-09 22:51:59 +01:00
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2011-06-13 00:08:19 +02:00
|
|
|
* @role: role of this device (client or GO)
|
|
|
|
* Sends signal with i/f name and role as string arguments
|
2009-11-09 22:51:59 +01:00
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *role)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
DBusMessage *msg;
|
2014-07-08 14:56:11 +02:00
|
|
|
DBusMessageIter iter, dict_iter;
|
2011-06-13 00:08:19 +02:00
|
|
|
struct wpas_dbus_priv *iface = wpa_s->global->dbus;
|
2014-10-23 10:31:21 +02:00
|
|
|
struct wpa_supplicant *parent;
|
2010-05-23 19:23:11 +02:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
parent = wpa_s->parent;
|
|
|
|
if (parent->p2p_mgmt)
|
|
|
|
parent = parent->parent;
|
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_groupobj_path || !wpa_s->dbus_new_path ||
|
|
|
|
!parent->dbus_new_path)
|
2014-07-08 14:56:11 +02:00
|
|
|
return;
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
msg = dbus_message_new_signal(parent->dbus_new_path,
|
2011-06-13 00:08:19 +02:00
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"GroupFinished");
|
|
|
|
if (msg == NULL)
|
2009-11-09 22:51:59 +01:00
|
|
|
return;
|
2011-06-13 00:08:19 +02:00
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2014-12-31 12:57:48 +01:00
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_object_path(&dict_iter,
|
2014-07-08 14:56:11 +02:00
|
|
|
"interface_object",
|
2014-12-31 12:57:48 +01:00
|
|
|
wpa_s->dbus_new_path) ||
|
|
|
|
!wpa_dbus_dict_append_string(&dict_iter, "role", role) ||
|
|
|
|
!wpa_dbus_dict_append_object_path(&dict_iter, "group_object",
|
2014-07-08 14:56:11 +02:00
|
|
|
wpa_s->dbus_groupobj_path) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
2014-12-31 12:57:48 +01:00
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-06 19:03:01 +01:00
|
|
|
/**
|
2011-06-13 00:08:19 +02:00
|
|
|
* wpas_dbus_signal_p2p_provision_discovery - Signals various PD events
|
2010-01-06 19:03:01 +01:00
|
|
|
*
|
2011-06-13 00:08:19 +02:00
|
|
|
* @dev_addr - who sent the request or responded to our request.
|
|
|
|
* @request - Will be 1 if request, 0 for response.
|
|
|
|
* @status - valid only in case of response
|
|
|
|
* @config_methods - wps config methods
|
|
|
|
* @generated_pin - pin to be displayed in case of WPS_CONFIG_DISPLAY method
|
|
|
|
*
|
|
|
|
* Sends following provision discovery related events:
|
|
|
|
* ProvisionDiscoveryRequestDisplayPin
|
|
|
|
* ProvisionDiscoveryResponseDisplayPin
|
|
|
|
* ProvisionDiscoveryRequestEnterPin
|
|
|
|
* ProvisionDiscoveryResponseEnterPin
|
|
|
|
* ProvisionDiscoveryPBCRequest
|
|
|
|
* ProvisionDiscoveryPBCResponse
|
|
|
|
*
|
|
|
|
* TODO::
|
|
|
|
* ProvisionDiscoveryFailure (timeout case)
|
2010-01-06 19:03:01 +01:00
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dev_addr, int request,
|
|
|
|
enum p2p_prov_disc_status status,
|
|
|
|
u16 config_methods,
|
|
|
|
unsigned int generated_pin)
|
2010-01-06 19:03:01 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
char *_signal;
|
|
|
|
int add_pin = 0;
|
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
|
|
|
int error_ret = 1;
|
|
|
|
char pin[9], *p_pin = NULL;
|
2010-01-06 19:03:01 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
2010-01-06 19:03:01 +01:00
|
|
|
return;
|
2011-06-13 00:08:19 +02:00
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
if (request || !status) {
|
|
|
|
if (config_methods & WPS_CONFIG_DISPLAY)
|
|
|
|
_signal = request ?
|
|
|
|
"ProvisionDiscoveryRequestDisplayPin" :
|
|
|
|
"ProvisionDiscoveryResponseEnterPin";
|
|
|
|
else if (config_methods & WPS_CONFIG_KEYPAD)
|
|
|
|
_signal = request ?
|
|
|
|
"ProvisionDiscoveryRequestEnterPin" :
|
|
|
|
"ProvisionDiscoveryResponseDisplayPin";
|
|
|
|
else if (config_methods & WPS_CONFIG_PUSHBUTTON)
|
|
|
|
_signal = request ? "ProvisionDiscoveryPBCRequest" :
|
|
|
|
"ProvisionDiscoveryPBCResponse";
|
|
|
|
else
|
|
|
|
return; /* Unknown or un-supported method */
|
2014-12-31 15:33:35 +01:00
|
|
|
} else {
|
2011-06-13 00:08:19 +02:00
|
|
|
/* Explicit check for failure response */
|
|
|
|
_signal = "ProvisionDiscoveryFailure";
|
2014-12-31 15:33:35 +01:00
|
|
|
}
|
2011-06-13 00:08:19 +02:00
|
|
|
|
|
|
|
add_pin = ((request && (config_methods & WPS_CONFIG_DISPLAY)) ||
|
|
|
|
(!request && !status &&
|
|
|
|
(config_methods & WPS_CONFIG_KEYPAD)));
|
|
|
|
|
|
|
|
if (add_pin) {
|
|
|
|
os_snprintf(pin, sizeof(pin), "%08d", generated_pin);
|
|
|
|
p_pin = pin;
|
2010-01-06 19:03:01 +01:00
|
|
|
}
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE, _signal);
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
2010-01-06 19:03:01 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/* Check if this is a known peer */
|
2011-12-22 20:04:41 +01:00
|
|
|
if (!p2p_peer_known(wpa_s->global->p2p, dev_addr))
|
2011-06-13 00:08:19 +02:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
|
|
|
|
COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(dev_addr));
|
|
|
|
|
|
|
|
path = peer_obj_path;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
|
|
|
|
if (!dbus_message_iter_append_basic(&iter,
|
|
|
|
DBUS_TYPE_OBJECT_PATH,
|
|
|
|
&path))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (!request && status)
|
|
|
|
/* Attach status to ProvisionDiscoveryFailure */
|
|
|
|
error_ret = !dbus_message_iter_append_basic(&iter,
|
|
|
|
DBUS_TYPE_INT32,
|
|
|
|
&status);
|
|
|
|
else
|
|
|
|
error_ret = (add_pin &&
|
|
|
|
!dbus_message_iter_append_basic(&iter,
|
|
|
|
DBUS_TYPE_STRING,
|
|
|
|
&p_pin));
|
|
|
|
|
|
|
|
error:
|
|
|
|
if (!error_ret)
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
else
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
2010-01-06 19:03:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-16 06:30:14 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_p2p_go_neg_req - Signal P2P GO Negotiation Request RX
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @src: Source address of the message triggering this notification
|
|
|
|
* @dev_passwd_id: WPS Device Password Id
|
|
|
|
* @go_intent: Peer's GO Intent value
|
|
|
|
*
|
|
|
|
* Sends signal to notify that a peer P2P Device is requesting group owner
|
|
|
|
* negotiation with us.
|
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
|
2015-06-02 07:47:33 +02:00
|
|
|
const u8 *src, u16 dev_passwd_id,
|
|
|
|
u8 go_intent)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(src));
|
|
|
|
path = peer_obj_path;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"GONegotiationRequest");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
|
|
|
&path) ||
|
|
|
|
!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT16,
|
2015-06-02 07:47:33 +02:00
|
|
|
&dev_passwd_id) ||
|
|
|
|
!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BYTE,
|
|
|
|
&go_intent))
|
2011-06-13 00:08:19 +02:00
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
2010-01-01 12:00:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
static int wpas_dbus_get_group_obj_path(struct wpa_supplicant *wpa_s,
|
|
|
|
const struct wpa_ssid *ssid,
|
|
|
|
char *group_obj_path)
|
2010-01-01 12:00:22 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
char group_name[3];
|
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path ||
|
|
|
|
os_memcmp(ssid->ssid, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN))
|
2011-06-13 00:08:19 +02:00
|
|
|
return -1;
|
|
|
|
|
2012-03-31 20:13:53 +02:00
|
|
|
os_memcpy(group_name, ssid->ssid + P2P_WILDCARD_SSID_LEN, 2);
|
2011-06-13 00:08:19 +02:00
|
|
|
group_name[2] = '\0';
|
|
|
|
|
|
|
|
os_snprintf(group_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_GROUPS_PART "/%s",
|
|
|
|
wpa_s->dbus_new_path, group_name);
|
|
|
|
|
|
|
|
return 0;
|
2010-01-01 12:00:22 +01:00
|
|
|
}
|
|
|
|
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2014-06-02 16:42:08 +02:00
|
|
|
struct group_changed_data {
|
|
|
|
struct wpa_supplicant *wpa_s;
|
|
|
|
struct p2p_peer_info *info;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int match_group_where_peer_is_client(struct p2p_group *group,
|
|
|
|
void *user_data)
|
|
|
|
{
|
|
|
|
struct group_changed_data *data = user_data;
|
|
|
|
const struct p2p_group_config *cfg;
|
|
|
|
struct wpa_supplicant *wpa_s_go;
|
|
|
|
|
|
|
|
if (!p2p_group_is_client_connected(group, data->info->p2p_device_addr))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
cfg = p2p_group_get_config(group);
|
|
|
|
|
|
|
|
wpa_s_go = wpas_get_p2p_go_iface(data->wpa_s, cfg->ssid,
|
|
|
|
cfg->ssid_len);
|
|
|
|
if (wpa_s_go != NULL && wpa_s_go == data->wpa_s) {
|
|
|
|
wpas_dbus_signal_peer_groups_changed(
|
2016-01-24 16:36:49 +01:00
|
|
|
data->wpa_s->p2pdev, data->info->p2p_device_addr);
|
2014-06-02 16:42:08 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void signal_peer_groups_changed(struct p2p_peer_info *info,
|
|
|
|
void *user_data)
|
|
|
|
{
|
|
|
|
struct group_changed_data *data = user_data;
|
|
|
|
struct wpa_supplicant *wpa_s_go;
|
|
|
|
|
|
|
|
wpa_s_go = wpas_get_p2p_client_iface(data->wpa_s,
|
|
|
|
info->p2p_device_addr);
|
|
|
|
if (wpa_s_go != NULL && wpa_s_go == data->wpa_s) {
|
2016-01-24 16:36:49 +01:00
|
|
|
wpas_dbus_signal_peer_groups_changed(data->wpa_s->p2pdev,
|
2014-06-02 16:42:08 +02:00
|
|
|
info->p2p_device_addr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
data->info = info;
|
|
|
|
p2p_loop_on_all_groups(data->wpa_s->global->p2p,
|
|
|
|
match_group_where_peer_is_client, data);
|
|
|
|
data->info = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void peer_groups_changed(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
struct group_changed_data data;
|
|
|
|
|
|
|
|
os_memset(&data, 0, sizeof(data));
|
|
|
|
data.wpa_s = wpa_s;
|
|
|
|
|
|
|
|
p2p_loop_on_known_peers(wpa_s->global->p2p,
|
|
|
|
signal_peer_groups_changed, &data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-01 12:00:22 +01:00
|
|
|
/**
|
2011-06-13 00:08:19 +02:00
|
|
|
* wpas_dbus_signal_p2p_group_started - Signals P2P group has
|
2011-09-21 23:43:59 +02:00
|
|
|
* started. Emitted when a group is successfully started
|
2011-06-13 00:08:19 +02:00
|
|
|
* irrespective of the role (client/GO) of the current device
|
2010-01-01 12:00:22 +01:00
|
|
|
*
|
2011-06-13 00:08:19 +02:00
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @client: this device is P2P client
|
2016-05-30 09:38:31 +02:00
|
|
|
* @persistent: 0 - non persistent group, 1 - persistent group
|
2016-11-02 11:20:28 +01:00
|
|
|
* @ip: When group role is client, it contains local IP address, netmask, and
|
|
|
|
* GO's IP address, if assigned; otherwise, NULL
|
2010-01-01 12:00:22 +01:00
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
2016-11-02 11:20:28 +01:00
|
|
|
int client, int persistent,
|
|
|
|
const u8 *ip)
|
2010-01-01 12:00:22 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
2014-10-23 10:31:21 +02:00
|
|
|
struct wpa_supplicant *parent;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
parent = wpa_s->parent;
|
|
|
|
if (parent->p2p_mgmt)
|
|
|
|
parent = parent->parent;
|
|
|
|
|
|
|
|
iface = parent->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !parent->dbus_new_path || !wpa_s->dbus_new_path)
|
2011-06-13 00:08:19 +02:00
|
|
|
return;
|
2010-01-04 16:15:57 +01:00
|
|
|
|
2014-05-14 15:10:41 +02:00
|
|
|
if (wpa_s->dbus_groupobj_path == NULL)
|
2011-06-13 00:08:19 +02:00
|
|
|
return;
|
2010-01-04 16:15:57 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/* New interface has been created for this group */
|
2014-10-23 10:31:21 +02:00
|
|
|
msg = dbus_message_new_signal(parent->dbus_new_path,
|
2011-06-13 00:08:19 +02:00
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"GroupStarted");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
2009-11-14 15:57:07 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
/*
|
|
|
|
* In case the device supports creating a separate interface the
|
|
|
|
* DBus client will need to know the object path for the interface
|
|
|
|
* object this group was created on, so include it here.
|
|
|
|
*/
|
2014-12-31 12:57:48 +01:00
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_object_path(&dict_iter,
|
|
|
|
"interface_object",
|
|
|
|
wpa_s->dbus_new_path) ||
|
|
|
|
!wpa_dbus_dict_append_string(&dict_iter, "role",
|
|
|
|
client ? "client" : "GO") ||
|
2016-05-30 09:38:31 +02:00
|
|
|
!wpa_dbus_dict_append_bool(&dict_iter, "persistent", persistent) ||
|
2014-12-31 12:57:48 +01:00
|
|
|
!wpa_dbus_dict_append_object_path(&dict_iter, "group_object",
|
2014-05-14 15:10:41 +02:00
|
|
|
wpa_s->dbus_groupobj_path) ||
|
2016-11-02 11:20:28 +01:00
|
|
|
(ip &&
|
|
|
|
(!wpa_dbus_dict_append_byte_array(&dict_iter, "IpAddr",
|
|
|
|
(char *) ip, 4) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "IpAddrMask",
|
|
|
|
(char *) ip + 4, 4) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "IpAddrGo",
|
|
|
|
(char *) ip + 8, 4))) ||
|
2014-12-31 12:57:48 +01:00
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
} else {
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
if (client)
|
|
|
|
peer_groups_changed(wpa_s);
|
|
|
|
}
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
2009-11-14 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-16 06:38:01 +02:00
|
|
|
* wpas_dbus_signal_p2p_go_neg_resp - Emit GONegotiation Success/Failure signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @res: Result of the GO Neg Request
|
2009-11-14 15:57:07 +01:00
|
|
|
*/
|
2011-12-18 15:52:33 +01:00
|
|
|
void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
|
|
|
|
struct p2p_go_neg_results *res)
|
2009-11-14 15:57:07 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
DBusMessage *msg;
|
2011-12-18 15:52:33 +01:00
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
DBusMessageIter iter_dict_entry, iter_dict_val, iter_dict_array;
|
2011-06-13 00:08:19 +02:00
|
|
|
struct wpas_dbus_priv *iface;
|
2011-12-18 15:52:33 +01:00
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
|
|
|
dbus_int32_t freqs[P2P_MAX_CHANNELS];
|
|
|
|
dbus_int32_t *f_array = freqs;
|
|
|
|
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
2011-12-18 15:52:33 +01:00
|
|
|
os_memset(freqs, 0, sizeof(freqs));
|
2011-06-13 00:08:19 +02:00
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2011-06-13 00:08:19 +02:00
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-12-18 15:52:33 +01:00
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(res->peer_device_addr));
|
|
|
|
path = peer_obj_path;
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2011-12-18 15:52:33 +01:00
|
|
|
res->status ? "GONegotiationFailure" :
|
|
|
|
"GONegotiationSuccess");
|
2011-06-13 00:08:19 +02:00
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-12-18 15:52:33 +01:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2014-12-31 12:57:48 +01:00
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object",
|
2011-12-18 15:52:33 +01:00
|
|
|
path) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "status", res->status))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (!res->status) {
|
|
|
|
int i = 0;
|
|
|
|
int freq_list_num = 0;
|
|
|
|
|
2014-12-31 12:57:48 +01:00
|
|
|
if ((res->role_go &&
|
|
|
|
!wpa_dbus_dict_append_string(&dict_iter, "passphrase",
|
|
|
|
res->passphrase)) ||
|
|
|
|
!wpa_dbus_dict_append_string(&dict_iter, "role_go",
|
2011-12-18 15:52:33 +01:00
|
|
|
res->role_go ? "GO" :
|
|
|
|
"client") ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "frequency",
|
|
|
|
res->freq) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "ssid",
|
|
|
|
(const char *) res->ssid,
|
|
|
|
res->ssid_len) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter,
|
|
|
|
"peer_device_addr",
|
|
|
|
(const char *)
|
|
|
|
res->peer_device_addr,
|
|
|
|
ETH_ALEN) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter,
|
|
|
|
"peer_interface_addr",
|
|
|
|
(const char *)
|
|
|
|
res->peer_interface_addr,
|
|
|
|
ETH_ALEN) ||
|
|
|
|
!wpa_dbus_dict_append_string(&dict_iter, "wps_method",
|
|
|
|
p2p_wps_method_text(
|
|
|
|
res->wps_method)))
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
2011-12-18 15:52:33 +01:00
|
|
|
|
|
|
|
for (i = 0; i < P2P_MAX_CHANNELS; i++) {
|
|
|
|
if (res->freq_list[i]) {
|
|
|
|
freqs[i] = res->freq_list[i];
|
|
|
|
freq_list_num++;
|
|
|
|
}
|
2011-06-13 00:08:19 +02:00
|
|
|
}
|
2011-12-18 15:52:33 +01:00
|
|
|
|
|
|
|
if (!wpa_dbus_dict_begin_array(&dict_iter,
|
|
|
|
"frequency_list",
|
|
|
|
DBUS_TYPE_INT32_AS_STRING,
|
|
|
|
&iter_dict_entry,
|
|
|
|
&iter_dict_val,
|
2014-12-31 12:57:48 +01:00
|
|
|
&iter_dict_array) ||
|
|
|
|
!dbus_message_iter_append_fixed_array(&iter_dict_array,
|
2011-12-18 15:52:33 +01:00
|
|
|
DBUS_TYPE_INT32,
|
|
|
|
&f_array,
|
2014-12-31 12:57:48 +01:00
|
|
|
freq_list_num) ||
|
|
|
|
!wpa_dbus_dict_end_array(&dict_iter,
|
2011-12-18 15:52:33 +01:00
|
|
|
&iter_dict_entry,
|
|
|
|
&iter_dict_val,
|
2014-12-31 12:57:48 +01:00
|
|
|
&iter_dict_array) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "persistent_group",
|
2011-12-18 15:52:33 +01:00
|
|
|
res->persistent_group) ||
|
|
|
|
!wpa_dbus_dict_append_uint32(&dict_iter,
|
|
|
|
"peer_config_timeout",
|
|
|
|
res->peer_config_timeout))
|
|
|
|
goto err;
|
2011-06-13 00:08:19 +02:00
|
|
|
}
|
|
|
|
|
2011-12-18 15:52:33 +01:00
|
|
|
if (!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
goto err;
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
err:
|
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-22 05:48:34 +02:00
|
|
|
* wpas_dbus_signal_p2p_invitation_result - Emit InvitationResult signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @status: Status of invitation process
|
|
|
|
* @bssid: Basic Service Set Identifier
|
2009-11-09 22:51:59 +01:00
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s,
|
|
|
|
int status, const u8 *bssid)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
|
2013-10-20 17:09:46 +02:00
|
|
|
wpa_printf(MSG_DEBUG, "%s", __func__);
|
2011-06-13 00:08:19 +02:00
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
2009-12-31 20:50:12 +01:00
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"InvitationResult");
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
2009-12-26 15:20:37 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2014-12-31 12:57:48 +01:00
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "status", status) ||
|
|
|
|
(bssid &&
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "BSSID",
|
|
|
|
(const char *) bssid,
|
|
|
|
ETH_ALEN)) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
2010-01-01 10:33:41 +01:00
|
|
|
|
|
|
|
|
2009-11-09 22:51:59 +01:00
|
|
|
/**
|
|
|
|
*
|
2011-06-13 00:08:19 +02:00
|
|
|
* Method to emit a signal for a peer joining the group.
|
|
|
|
* The signal will carry path to the group member object
|
|
|
|
* constructed using p2p i/f addr used for connecting.
|
|
|
|
*
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2014-06-02 16:42:06 +02:00
|
|
|
* @peer_addr: P2P Device Address of the peer joining the group
|
2009-11-09 22:51:59 +01:00
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
|
2014-06-02 16:42:06 +02:00
|
|
|
const u8 *peer_addr)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter;
|
2014-06-02 16:42:06 +02:00
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
2014-10-23 10:31:21 +02:00
|
|
|
struct wpa_supplicant *parent;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
if (!wpa_s->dbus_groupobj_path)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
parent = wpa_s->parent;
|
|
|
|
if (parent->p2p_mgmt)
|
|
|
|
parent = parent->parent;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!parent->dbus_new_path)
|
|
|
|
return;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2014-06-02 16:42:06 +02:00
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
|
2011-06-13 00:08:19 +02:00
|
|
|
COMPACT_MACSTR,
|
2014-10-23 10:31:21 +02:00
|
|
|
parent->dbus_new_path, MAC2STR(peer_addr));
|
2010-01-01 10:33:41 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2P_GROUP,
|
|
|
|
"PeerJoined");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2014-06-02 16:42:06 +02:00
|
|
|
path = peer_obj_path;
|
2011-06-13 00:08:19 +02:00
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
2014-12-31 12:57:48 +01:00
|
|
|
&path)) {
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
} else {
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
wpas_dbus_signal_peer_groups_changed(parent, peer_addr);
|
|
|
|
}
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2011-06-13 00:08:19 +02:00
|
|
|
* Method to emit a signal for a peer disconnecting the group.
|
|
|
|
* The signal will carry path to the group member object
|
2014-06-02 16:42:06 +02:00
|
|
|
* constructed using the P2P Device Address of the peer.
|
2011-06-13 00:08:19 +02:00
|
|
|
*
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2014-06-02 16:42:06 +02:00
|
|
|
* @peer_addr: P2P Device Address of the peer joining the group
|
2009-11-09 22:51:59 +01:00
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
|
2014-06-02 16:42:06 +02:00
|
|
|
const u8 *peer_addr)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter;
|
2014-06-02 16:42:06 +02:00
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
2014-10-23 10:31:21 +02:00
|
|
|
struct wpa_supplicant *parent;
|
2011-06-13 00:08:19 +02:00
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2011-06-13 00:08:19 +02:00
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
if (!wpa_s->dbus_groupobj_path)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
parent = wpa_s->parent;
|
|
|
|
if (parent->p2p_mgmt)
|
|
|
|
parent = parent->parent;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!parent->dbus_new_path)
|
|
|
|
return;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2014-06-02 16:42:06 +02:00
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
|
2011-06-13 00:08:19 +02:00
|
|
|
COMPACT_MACSTR,
|
2014-10-23 10:31:21 +02:00
|
|
|
parent->dbus_new_path, MAC2STR(peer_addr));
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2P_GROUP,
|
|
|
|
"PeerDisconnected");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2014-06-02 16:42:06 +02:00
|
|
|
path = peer_obj_path;
|
2011-06-13 00:08:19 +02:00
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
2014-12-31 12:57:48 +01:00
|
|
|
&path)) {
|
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"dbus: Failed to construct PeerDisconnected signal");
|
|
|
|
} else {
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
wpas_dbus_signal_peer_groups_changed(parent, peer_addr);
|
|
|
|
}
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
2010-01-01 10:33:41 +01:00
|
|
|
|
|
|
|
|
2009-11-09 22:51:59 +01:00
|
|
|
/**
|
|
|
|
*
|
2011-06-13 00:08:19 +02:00
|
|
|
* Method to emit a signal for a service discovery request.
|
|
|
|
* The signal will carry station address, frequency, dialog token,
|
|
|
|
* update indicator and it tlvs
|
|
|
|
*
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @sa: station addr (p2p i/f) of the peer
|
|
|
|
* @dialog_token: service discovery request dialog token
|
|
|
|
* @update_indic: service discovery request update indicator
|
|
|
|
* @tlvs: service discovery request genrated byte array of tlvs
|
|
|
|
* @tlvs_len: service discovery request tlvs length
|
2009-11-09 22:51:59 +01:00
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s,
|
|
|
|
int freq, const u8 *sa, u8 dialog_token,
|
|
|
|
u16 update_indic, const u8 *tlvs,
|
|
|
|
size_t tlvs_len)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
2014-12-31 22:21:10 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2011-06-13 00:08:19 +02:00
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2014-12-31 12:57:48 +01:00
|
|
|
/* Check if this is a known peer */
|
|
|
|
if (!p2p_peer_known(wpa_s->global->p2p, sa))
|
|
|
|
return;
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"ServiceDiscoveryRequest");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
|
|
|
|
COMPACT_MACSTR, wpa_s->dbus_new_path, MAC2STR(sa));
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
path = peer_obj_path;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2014-12-31 12:57:48 +01:00
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object",
|
2011-06-13 00:08:19 +02:00
|
|
|
path) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "frequency", freq) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "dialog_token",
|
|
|
|
dialog_token) ||
|
|
|
|
!wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator",
|
|
|
|
update_indic) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "tlvs",
|
|
|
|
(const char *) tlvs,
|
|
|
|
tlvs_len) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
2014-12-31 12:57:48 +01:00
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-14 14:57:02 +01:00
|
|
|
/**
|
|
|
|
*
|
2011-06-13 00:08:19 +02:00
|
|
|
* Method to emit a signal for a service discovery response.
|
|
|
|
* The signal will carry station address, update indicator and it
|
|
|
|
* tlvs
|
|
|
|
*
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @sa: station addr (p2p i/f) of the peer
|
|
|
|
* @update_indic: service discovery request update indicator
|
|
|
|
* @tlvs: service discovery request genrated byte array of tlvs
|
|
|
|
* @tlvs_len: service discovery request tlvs length
|
2009-11-14 14:57:02 +01:00
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
void wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *sa, u16 update_indic,
|
|
|
|
const u8 *tlvs, size_t tlvs_len)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
2014-12-31 22:21:10 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
iface = wpa_s->global->dbus;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2011-06-13 00:08:19 +02:00
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2014-12-31 12:57:48 +01:00
|
|
|
/* Check if this is a known peer */
|
|
|
|
if (!p2p_peer_known(wpa_s->global->p2p, sa))
|
|
|
|
return;
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-10-23 10:31:21 +02:00
|
|
|
"ServiceDiscoveryResponse");
|
2011-06-13 00:08:19 +02:00
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
|
|
|
|
COMPACT_MACSTR, wpa_s->dbus_new_path, MAC2STR(sa));
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
path = peer_obj_path;
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
2014-12-31 12:57:48 +01:00
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object",
|
2011-06-13 00:08:19 +02:00
|
|
|
path) ||
|
|
|
|
!wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator",
|
|
|
|
update_indic) ||
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "tlvs",
|
|
|
|
(const char *) tlvs,
|
|
|
|
tlvs_len) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
2014-12-31 12:57:48 +01:00
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2011-06-13 00:08:19 +02:00
|
|
|
dbus_message_unref(msg);
|
2009-11-09 22:51:59 +01:00
|
|
|
}
|
|
|
|
|
2014-12-31 12:57:48 +01:00
|
|
|
|
2011-06-23 20:25:13 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_persistent_group - Send a persistent group related
|
|
|
|
* event signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @id: new persistent group id
|
|
|
|
* @sig_name: signal name - PersistentGroupAdded, PersistentGroupRemoved
|
|
|
|
* @properties: determines if add second argument with object properties
|
|
|
|
*
|
|
|
|
* Notify listeners about an event related to persistent groups.
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_persistent_group(struct wpa_supplicant *wpa_s,
|
|
|
|
int id, const char *sig_name,
|
2018-10-07 14:31:50 +02:00
|
|
|
dbus_bool_t properties)
|
2011-06-23 20:25:13 +02:00
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
2011-07-29 20:25:39 +02:00
|
|
|
DBusMessageIter iter;
|
2011-06-23 20:25:13 +02:00
|
|
|
char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2011-06-23 20:25:13 +02:00
|
|
|
os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, id);
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
sig_name);
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
path = pgrp_obj_path;
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
2014-12-31 12:57:48 +01:00
|
|
|
&path) ||
|
|
|
|
(properties &&
|
|
|
|
!wpa_dbus_get_object_properties(
|
|
|
|
iface, pgrp_obj_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, &iter)))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2011-06-23 20:25:13 +02:00
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_persistent_group_added - Send a persistent_group
|
|
|
|
* added signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @id: new persistent group id
|
|
|
|
*
|
|
|
|
* Notify listeners about addition of a new persistent group.
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_persistent_group_added(
|
|
|
|
struct wpa_supplicant *wpa_s, int id)
|
|
|
|
{
|
|
|
|
wpas_dbus_signal_persistent_group(wpa_s, id, "PersistentGroupAdded",
|
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_persistent_group_removed - Send a persistent_group
|
|
|
|
* removed signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @id: persistent group id
|
|
|
|
*
|
|
|
|
* Notify listeners about removal of a persistent group.
|
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_persistent_group_removed(
|
|
|
|
struct wpa_supplicant *wpa_s, int id)
|
|
|
|
{
|
|
|
|
wpas_dbus_signal_persistent_group(wpa_s, id, "PersistentGroupRemoved",
|
2011-06-24 10:20:19 +02:00
|
|
|
FALSE);
|
2011-06-23 20:25:13 +02:00
|
|
|
}
|
|
|
|
|
2011-06-25 10:47:04 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_p2p_wps_failed - Signals WpsFailed event
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2015-06-16 07:06:12 +02:00
|
|
|
* @fail: WPS failure information
|
2011-06-25 10:47:04 +02:00
|
|
|
*
|
|
|
|
* Sends Event dbus signal with name "fail" and dictionary containing
|
|
|
|
* "msg" field with fail message number (int32) as arguments
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wps_event_fail *fail)
|
|
|
|
{
|
|
|
|
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
char *key = "fail";
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2011-06-25 10:47:04 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"WpsFailed");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
|
|
|
|
!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "msg", fail->msg) ||
|
|
|
|
!wpa_dbus_dict_append_int16(&dict_iter, "config_error",
|
|
|
|
fail->config_error) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
2015-08-20 12:58:33 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_p2p_group_formation_failure - Signals GroupFormationFailure event
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @reason: indicates the reason code for group formation failure
|
|
|
|
*
|
|
|
|
* Sends Event dbus signal and string reason code when available.
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *reason)
|
|
|
|
{
|
|
|
|
DBusMessage *msg;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
|
|
|
|
2018-02-12 20:27:20 +01:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
2015-08-20 12:58:33 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"GroupFormationFailure");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &reason,
|
|
|
|
DBUS_TYPE_INVALID))
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
else
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
2015-06-18 06:16:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_p2p_invitation_received - Emit InvitationReceived signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @sa: Source address of the Invitation Request
|
|
|
|
* @dev_add: GO Device Address
|
|
|
|
* @bssid: P2P Group BSSID or %NULL if not received
|
|
|
|
* @id: Persistent group id or %0 if not persistent group
|
|
|
|
* @op_freq: Operating frequency for the group
|
|
|
|
*/
|
|
|
|
|
|
|
|
void wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *sa, const u8 *dev_addr,
|
|
|
|
const u8 *bssid, int id,
|
|
|
|
int op_freq)
|
|
|
|
{
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter, dict_iter;
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
|
|
|
|
2018-02-12 20:27:20 +01:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
2015-06-18 06:16:34 +02:00
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"InvitationReceived");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
|
|
|
|
(sa &&
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "sa",
|
|
|
|
(const char *) sa, ETH_ALEN)) ||
|
|
|
|
(dev_addr &&
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "go_dev_addr",
|
|
|
|
(const char *) dev_addr,
|
|
|
|
ETH_ALEN)) ||
|
|
|
|
(bssid &&
|
|
|
|
!wpa_dbus_dict_append_byte_array(&dict_iter, "bssid",
|
|
|
|
(const char *) bssid,
|
|
|
|
ETH_ALEN)) ||
|
|
|
|
(id &&
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "persistent_id", id)) ||
|
|
|
|
!wpa_dbus_dict_append_int32(&dict_iter, "op_freq", op_freq) ||
|
|
|
|
!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2015-11-17 07:19:57 +01:00
|
|
|
dbus_message_unref(msg);
|
2015-06-18 06:16:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-31 12:57:48 +01:00
|
|
|
#endif /* CONFIG_P2P */
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_prop_changed - Signals change of property
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @property: indicates which property has changed
|
|
|
|
*
|
2011-06-13 00:09:32 +02:00
|
|
|
* Sends PropertyChanged signals with path, interface and arguments
|
2011-06-13 00:08:19 +02:00
|
|
|
* depending on which property has changed.
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
|
|
|
enum wpas_dbus_prop property)
|
|
|
|
{
|
|
|
|
char *prop;
|
2012-06-30 15:43:50 +02:00
|
|
|
dbus_bool_t flush;
|
2011-06-13 00:08:19 +02:00
|
|
|
|
|
|
|
if (wpa_s->dbus_new_path == NULL)
|
|
|
|
return; /* Skip signal since D-Bus setup is not yet ready */
|
|
|
|
|
2012-06-30 15:43:50 +02:00
|
|
|
flush = FALSE;
|
2011-06-13 00:08:19 +02:00
|
|
|
switch (property) {
|
|
|
|
case WPAS_DBUS_PROP_AP_SCAN:
|
|
|
|
prop = "ApScan";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_PROP_SCANNING:
|
|
|
|
prop = "Scanning";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_PROP_STATE:
|
|
|
|
prop = "State";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_PROP_CURRENT_BSS:
|
|
|
|
prop = "CurrentBSS";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_PROP_CURRENT_NETWORK:
|
|
|
|
prop = "CurrentNetwork";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_PROP_BSSS:
|
|
|
|
prop = "BSSs";
|
|
|
|
break;
|
2018-10-07 14:31:51 +02:00
|
|
|
case WPAS_DBUS_PROP_STATIONS:
|
|
|
|
prop = "Stations";
|
|
|
|
break;
|
2011-06-13 00:08:19 +02:00
|
|
|
case WPAS_DBUS_PROP_CURRENT_AUTH_MODE:
|
|
|
|
prop = "CurrentAuthMode";
|
|
|
|
break;
|
2012-06-30 15:43:50 +02:00
|
|
|
case WPAS_DBUS_PROP_DISCONNECT_REASON:
|
|
|
|
prop = "DisconnectReason";
|
|
|
|
flush = TRUE;
|
|
|
|
break;
|
2018-07-06 01:29:09 +02:00
|
|
|
case WPAS_DBUS_PROP_AUTH_STATUS_CODE:
|
|
|
|
prop = "AuthStatusCode";
|
|
|
|
flush = TRUE;
|
|
|
|
break;
|
2016-03-03 19:48:09 +01:00
|
|
|
case WPAS_DBUS_PROP_ASSOC_STATUS_CODE:
|
|
|
|
prop = "AssocStatusCode";
|
|
|
|
flush = TRUE;
|
|
|
|
break;
|
2018-06-21 01:42:45 +02:00
|
|
|
case WPAS_DBUS_PROP_ROAM_TIME:
|
|
|
|
prop = "RoamTime";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_PROP_ROAM_COMPLETE:
|
|
|
|
prop = "RoamComplete";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_PROP_SESSION_LENGTH:
|
|
|
|
prop = "SessionLength";
|
|
|
|
break;
|
2018-05-04 20:16:18 +02:00
|
|
|
case WPAS_DBUS_PROP_BSS_TM_STATUS:
|
|
|
|
prop = "BSSTMStatus";
|
|
|
|
break;
|
2011-06-13 00:08:19 +02:00
|
|
|
default:
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
|
|
|
|
__func__, property);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpa_dbus_mark_property_changed(wpa_s->global->dbus,
|
|
|
|
wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_INTERFACE, prop);
|
2012-06-30 15:43:50 +02:00
|
|
|
if (flush) {
|
|
|
|
wpa_dbus_flush_object_changed_properties(
|
|
|
|
wpa_s->global->dbus->con, wpa_s->dbus_new_path);
|
|
|
|
}
|
2011-06-13 00:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_bss_signal_prop_changed - Signals change of BSS property
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @property: indicates which property has changed
|
|
|
|
* @id: unique BSS identifier
|
|
|
|
*
|
|
|
|
* Sends PropertyChanged signals with path, interface, and arguments depending
|
|
|
|
* on which property has changed.
|
|
|
|
*/
|
|
|
|
void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
|
|
|
enum wpas_dbus_bss_prop property,
|
|
|
|
unsigned int id)
|
|
|
|
{
|
|
|
|
char path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
char *prop;
|
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
switch (property) {
|
|
|
|
case WPAS_DBUS_BSS_PROP_SIGNAL:
|
|
|
|
prop = "Signal";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_BSS_PROP_FREQ:
|
|
|
|
prop = "Frequency";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_BSS_PROP_MODE:
|
|
|
|
prop = "Mode";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_BSS_PROP_PRIVACY:
|
|
|
|
prop = "Privacy";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_BSS_PROP_RATES:
|
|
|
|
prop = "Rates";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_BSS_PROP_WPA:
|
|
|
|
prop = "WPA";
|
|
|
|
break;
|
|
|
|
case WPAS_DBUS_BSS_PROP_RSN:
|
|
|
|
prop = "RSN";
|
|
|
|
break;
|
2013-02-09 11:13:54 +01:00
|
|
|
case WPAS_DBUS_BSS_PROP_WPS:
|
|
|
|
prop = "WPS";
|
|
|
|
break;
|
2011-06-13 00:08:19 +02:00
|
|
|
case WPAS_DBUS_BSS_PROP_IES:
|
|
|
|
prop = "IEs";
|
|
|
|
break;
|
2014-09-04 20:10:54 +02:00
|
|
|
case WPAS_DBUS_BSS_PROP_AGE:
|
|
|
|
prop = "Age";
|
|
|
|
break;
|
2011-06-13 00:08:19 +02:00
|
|
|
default:
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
|
|
|
|
__func__, property);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, id);
|
|
|
|
|
|
|
|
wpa_dbus_mark_property_changed(wpa_s->global->dbus, path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_BSS, prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-10-07 14:31:51 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_sta_signal_prop_changed - Signals change of STA property
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @property: indicates which property has changed
|
|
|
|
* @address: unique BSS identifier
|
|
|
|
*
|
|
|
|
* Sends PropertyChanged signals with path, interface, and arguments depending
|
|
|
|
* on which property has changed.
|
|
|
|
*/
|
|
|
|
void wpas_dbus_sta_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
|
|
|
enum wpas_dbus_bss_prop property,
|
|
|
|
u8 address[ETH_ALEN])
|
|
|
|
{
|
|
|
|
char path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
char *prop;
|
|
|
|
|
|
|
|
switch (property) {
|
|
|
|
case WPAS_DBUS_STA_PROP_ADDRESS:
|
|
|
|
prop = "Address";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
|
|
|
|
__func__, property);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_STAS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(address));
|
|
|
|
|
|
|
|
wpa_dbus_mark_property_changed(wpa_s->global->dbus, path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_STA, prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_debug_level_changed - Signals change of debug param
|
|
|
|
* @global: wpa_global structure
|
|
|
|
*
|
2011-06-13 00:09:32 +02:00
|
|
|
* Sends PropertyChanged signals informing that debug level has changed.
|
2011-06-13 00:08:19 +02:00
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_debug_level_changed(struct wpa_global *global)
|
|
|
|
{
|
|
|
|
wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH,
|
|
|
|
WPAS_DBUS_NEW_INTERFACE,
|
|
|
|
"DebugLevel");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_debug_timestamp_changed - Signals change of debug param
|
|
|
|
* @global: wpa_global structure
|
|
|
|
*
|
2011-06-13 00:09:32 +02:00
|
|
|
* Sends PropertyChanged signals informing that debug timestamp has changed.
|
2011-06-13 00:08:19 +02:00
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global)
|
|
|
|
{
|
|
|
|
wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH,
|
|
|
|
WPAS_DBUS_NEW_INTERFACE,
|
|
|
|
"DebugTimestamp");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_debug_show_keys_changed - Signals change of debug param
|
|
|
|
* @global: wpa_global structure
|
|
|
|
*
|
2011-06-13 00:09:32 +02:00
|
|
|
* Sends PropertyChanged signals informing that debug show_keys has changed.
|
2011-06-13 00:08:19 +02:00
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global)
|
|
|
|
{
|
|
|
|
wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH,
|
|
|
|
WPAS_DBUS_NEW_INTERFACE,
|
|
|
|
"DebugShowKeys");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpas_dbus_register(struct wpa_dbus_object_desc *obj_desc,
|
|
|
|
void *priv,
|
|
|
|
WPADBusArgumentFreeFunction priv_free,
|
|
|
|
const struct wpa_dbus_method_desc *methods,
|
|
|
|
const struct wpa_dbus_property_desc *properties,
|
|
|
|
const struct wpa_dbus_signal_desc *signals)
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
|
|
|
obj_desc->user_data = priv;
|
|
|
|
obj_desc->user_data_free_func = priv_free;
|
|
|
|
obj_desc->methods = methods;
|
|
|
|
obj_desc->properties = properties;
|
|
|
|
obj_desc->signals = signals;
|
|
|
|
|
|
|
|
for (n = 0; properties && properties->dbus_property; properties++)
|
|
|
|
n++;
|
|
|
|
|
|
|
|
obj_desc->prop_changed_flags = os_zalloc(n);
|
|
|
|
if (!obj_desc->prop_changed_flags)
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: %s: can't register handlers",
|
|
|
|
__func__);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const struct wpa_dbus_method_desc wpas_dbus_global_methods[] = {
|
|
|
|
{ "CreateInterface", WPAS_DBUS_NEW_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_create_interface,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "RemoveInterface", WPAS_DBUS_NEW_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_remove_interface,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "path", "o", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "GetInterface", WPAS_DBUS_NEW_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_get_interface,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "ifname", "s", ARG_IN },
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-09-29 23:13:33 +02:00
|
|
|
{ "ExpectDisconnect", WPAS_DBUS_NEW_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_expect_disconnect,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ NULL, NULL, NULL, { END_ARGS } }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct wpa_dbus_property_desc wpas_dbus_global_properties[] = {
|
|
|
|
{ "DebugLevel", WPAS_DBUS_NEW_INTERFACE, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_debug_level,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_debug_level,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "DebugTimestamp", WPAS_DBUS_NEW_INTERFACE, "b",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_debug_timestamp,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_debug_timestamp,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "DebugShowKeys", WPAS_DBUS_NEW_INTERFACE, "b",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_debug_show_keys,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_debug_show_keys,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Interfaces", WPAS_DBUS_NEW_INTERFACE, "ao",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_interfaces,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "EapMethods", WPAS_DBUS_NEW_INTERFACE, "as",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_eap_methods,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
2012-09-29 18:06:30 +02:00
|
|
|
{ "Capabilities", WPAS_DBUS_NEW_INTERFACE, "as",
|
|
|
|
wpas_dbus_getter_global_capabilities,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-09-29 18:06:30 +02:00
|
|
|
NULL
|
|
|
|
},
|
2014-09-15 07:04:31 +02:00
|
|
|
#ifdef CONFIG_WIFI_DISPLAY
|
|
|
|
{ "WFDIEs", WPAS_DBUS_NEW_INTERFACE, "ay",
|
|
|
|
wpas_dbus_getter_global_wfd_ies,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_global_wfd_ies,
|
|
|
|
NULL
|
2014-09-15 07:04:31 +02:00
|
|
|
},
|
|
|
|
#endif /* CONFIG_WIFI_DISPLAY */
|
2015-10-13 18:47:46 +02:00
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
2011-06-13 00:08:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct wpa_dbus_signal_desc wpas_dbus_global_signals[] = {
|
|
|
|
{ "InterfaceAdded", WPAS_DBUS_NEW_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "InterfaceRemoved", WPAS_DBUS_NEW_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-10-29 18:23:42 +02:00
|
|
|
/* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "PropertiesChanged", WPAS_DBUS_NEW_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ NULL, NULL, { END_ARGS } }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-10-13 18:47:46 +02:00
|
|
|
static char * uscore_to_dbus(const char *uscore)
|
|
|
|
{
|
|
|
|
const char *p = uscore;
|
|
|
|
char *str, *s;
|
|
|
|
dbus_bool_t last_was_uscore = TRUE;
|
|
|
|
|
|
|
|
s = str = os_zalloc(os_strlen(uscore) + 1);
|
|
|
|
if (!str)
|
|
|
|
return NULL;
|
|
|
|
while (p && *p) {
|
|
|
|
if (*p == '_') {
|
|
|
|
last_was_uscore = TRUE;
|
|
|
|
} else {
|
|
|
|
*s++ = last_was_uscore ? toupper(*p) : *p;
|
|
|
|
last_was_uscore = FALSE;
|
|
|
|
}
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int wpa_dbus_ctrl_iface_props_init(struct wpas_dbus_priv *priv);
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_dbus_ctrl_iface_props_deinit(struct wpas_dbus_priv *priv)
|
|
|
|
{
|
|
|
|
int idx = priv->globals_start;
|
|
|
|
|
|
|
|
/* Free all allocated property values */
|
|
|
|
while (priv->all_interface_properties[idx].dbus_property)
|
|
|
|
os_free((char *)
|
|
|
|
priv->all_interface_properties[idx++].dbus_property);
|
|
|
|
os_free((char *) priv->all_interface_properties);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_ctrl_iface_init - Initialize dbus control interface
|
|
|
|
* @global: Pointer to global data from wpa_supplicant_init()
|
|
|
|
* Returns: 0 on success or -1 on failure
|
|
|
|
*
|
2015-10-13 18:47:46 +02:00
|
|
|
* Initialize the dbus control interface for wpa_supplicant and start
|
2011-06-13 00:08:19 +02:00
|
|
|
* receiving commands from external programs over the bus.
|
|
|
|
*/
|
|
|
|
int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv)
|
|
|
|
{
|
|
|
|
struct wpa_dbus_object_desc *obj_desc;
|
|
|
|
int ret;
|
|
|
|
|
2015-10-13 18:47:46 +02:00
|
|
|
ret = wpa_dbus_ctrl_iface_props_init(priv);
|
|
|
|
if (ret < 0) {
|
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"dbus: Not enough memory to init interface properties");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
|
|
|
if (!obj_desc) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create object description");
|
2015-10-13 18:47:46 +02:00
|
|
|
goto error;
|
2011-06-13 00:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
wpas_dbus_register(obj_desc, priv->global, NULL,
|
|
|
|
wpas_dbus_global_methods,
|
|
|
|
wpas_dbus_global_properties,
|
|
|
|
wpas_dbus_global_signals);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Register D-Bus object '%s'",
|
|
|
|
WPAS_DBUS_NEW_PATH);
|
|
|
|
ret = wpa_dbus_ctrl_iface_init(priv, WPAS_DBUS_NEW_PATH,
|
|
|
|
WPAS_DBUS_NEW_SERVICE,
|
|
|
|
obj_desc);
|
2015-10-13 18:47:46 +02:00
|
|
|
if (ret < 0) {
|
2011-06-13 00:08:19 +02:00
|
|
|
free_dbus_object_desc(obj_desc);
|
2015-10-13 18:47:46 +02:00
|
|
|
goto error;
|
|
|
|
}
|
2011-06-13 00:08:19 +02:00
|
|
|
|
2015-10-13 18:47:46 +02:00
|
|
|
priv->dbus_new_initialized = 1;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
|
|
|
wpa_dbus_ctrl_iface_props_deinit(priv);
|
|
|
|
return -1;
|
2011-06-13 00:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_ctrl_iface_deinit - Deinitialize dbus ctrl interface for
|
|
|
|
* wpa_supplicant
|
2015-10-13 18:47:46 +02:00
|
|
|
* @priv: Pointer to dbus private data from wpas_dbus_init()
|
2011-06-13 00:08:19 +02:00
|
|
|
*
|
|
|
|
* Deinitialize the dbus control interface that was initialized with
|
|
|
|
* wpas_dbus_ctrl_iface_init().
|
|
|
|
*/
|
2015-10-13 18:47:46 +02:00
|
|
|
void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *priv)
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
2015-10-13 18:47:46 +02:00
|
|
|
if (!priv->dbus_new_initialized)
|
2011-06-13 00:08:19 +02:00
|
|
|
return;
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Unregister D-Bus object '%s'",
|
|
|
|
WPAS_DBUS_NEW_PATH);
|
2015-10-13 18:47:46 +02:00
|
|
|
dbus_connection_unregister_object_path(priv->con, WPAS_DBUS_NEW_PATH);
|
|
|
|
wpa_dbus_ctrl_iface_props_deinit(priv);
|
2011-06-13 00:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_dbus_free(void *ptr)
|
|
|
|
{
|
|
|
|
os_free(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const struct wpa_dbus_property_desc wpas_dbus_network_properties[] = {
|
|
|
|
{ "Properties", WPAS_DBUS_NEW_IFACE_NETWORK, "a{sv}",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_network_properties,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_network_properties,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Enabled", WPAS_DBUS_NEW_IFACE_NETWORK, "b",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_enabled,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_enabled,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
2015-10-13 18:47:46 +02:00
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
2011-06-13 00:08:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static const struct wpa_dbus_signal_desc wpas_dbus_network_signals[] = {
|
2011-10-29 18:23:42 +02:00
|
|
|
/* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "PropertiesChanged", WPAS_DBUS_NEW_IFACE_NETWORK,
|
|
|
|
{
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ NULL, NULL, { END_ARGS } }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_register_network - Register a configured network with dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @ssid: network configuration data
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Registers network representing object with dbus
|
|
|
|
*/
|
|
|
|
int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_ssid *ssid)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
struct wpa_dbus_object_desc *obj_desc;
|
|
|
|
struct network_handler_args *arg;
|
|
|
|
char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
|
2011-06-27 20:23:22 +02:00
|
|
|
#ifdef CONFIG_P2P
|
2011-06-23 20:25:13 +02:00
|
|
|
/*
|
|
|
|
* If it is a persistent group register it as such.
|
|
|
|
* This is to handle cases where an interface is being initialized
|
|
|
|
* with a list of networks read from config.
|
|
|
|
*/
|
|
|
|
if (network_is_persistent_group(ssid))
|
|
|
|
return wpas_dbus_register_persistent_group(wpa_s, ssid);
|
2011-06-27 20:23:22 +02:00
|
|
|
#endif /* CONFIG_P2P */
|
2011-06-23 20:25:13 +02:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path)
|
2011-06-13 00:08:19 +02:00
|
|
|
return 0;
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, ssid->id);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Register network object '%s'",
|
|
|
|
net_obj_path);
|
|
|
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
|
|
|
if (!obj_desc) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create object description");
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* allocate memory for handlers arguments */
|
|
|
|
arg = os_zalloc(sizeof(struct network_handler_args));
|
|
|
|
if (!arg) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create arguments for method");
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
arg->wpa_s = wpa_s;
|
|
|
|
arg->ssid = ssid;
|
|
|
|
|
|
|
|
wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL,
|
|
|
|
wpas_dbus_network_properties,
|
|
|
|
wpas_dbus_network_signals);
|
|
|
|
|
|
|
|
if (wpa_dbus_register_object_per_iface(ctrl_iface, net_obj_path,
|
|
|
|
wpa_s->ifname, obj_desc))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
wpas_dbus_signal_network_added(wpa_s, ssid->id);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
free_dbus_object_desc(obj_desc);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_unregister_network - Unregister a configured network from dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @nid: network id
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Unregisters network representing object from dbus
|
|
|
|
*/
|
|
|
|
int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
int ret;
|
2012-04-28 17:31:01 +02:00
|
|
|
#ifdef CONFIG_P2P
|
2011-06-23 20:25:13 +02:00
|
|
|
struct wpa_ssid *ssid;
|
|
|
|
|
|
|
|
ssid = wpa_config_get_network(wpa_s->conf, nid);
|
|
|
|
|
|
|
|
/* If it is a persistent group unregister it as such */
|
|
|
|
if (ssid && network_is_persistent_group(ssid))
|
|
|
|
return wpas_dbus_unregister_persistent_group(wpa_s, nid);
|
2011-06-27 20:23:22 +02:00
|
|
|
#endif /* CONFIG_P2P */
|
2011-06-13 00:08:19 +02:00
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2011-10-16 12:16:21 +02:00
|
|
|
if (wpa_s->global == NULL || wpa_s->dbus_new_path == NULL)
|
2011-06-13 00:08:19 +02:00
|
|
|
return 0;
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, nid);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Unregister network object '%s'",
|
|
|
|
net_obj_path);
|
|
|
|
ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, net_obj_path);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
wpas_dbus_signal_network_removed(wpa_s, nid);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const struct wpa_dbus_property_desc wpas_dbus_bss_properties[] = {
|
|
|
|
{ "SSID", WPAS_DBUS_NEW_IFACE_BSS, "ay",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_ssid,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "BSSID", WPAS_DBUS_NEW_IFACE_BSS, "ay",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_bssid,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Privacy", WPAS_DBUS_NEW_IFACE_BSS, "b",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_privacy,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Mode", WPAS_DBUS_NEW_IFACE_BSS, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_mode,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Signal", WPAS_DBUS_NEW_IFACE_BSS, "n",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_signal,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Frequency", WPAS_DBUS_NEW_IFACE_BSS, "q",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_frequency,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Rates", WPAS_DBUS_NEW_IFACE_BSS, "au",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_rates,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "WPA", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_wpa,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "RSN", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_rsn,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
2012-11-03 17:37:20 +01:00
|
|
|
{ "WPS", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
|
|
|
|
wpas_dbus_getter_bss_wps,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-11-03 17:37:20 +01:00
|
|
|
NULL
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "IEs", WPAS_DBUS_NEW_IFACE_BSS, "ay",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_ies,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
2014-09-04 20:10:54 +02:00
|
|
|
{ "Age", WPAS_DBUS_NEW_IFACE_BSS, "u",
|
|
|
|
wpas_dbus_getter_bss_age,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2014-09-04 20:10:54 +02:00
|
|
|
NULL
|
|
|
|
},
|
2018-06-21 01:42:45 +02:00
|
|
|
{
|
|
|
|
"RoamTime", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
|
|
|
|
wpas_dbus_getter_roam_time,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"RoamComplete", WPAS_DBUS_NEW_IFACE_INTERFACE, "b",
|
|
|
|
wpas_dbus_getter_roam_complete,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"SessionLength", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
|
|
|
|
wpas_dbus_getter_session_length,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2018-05-04 20:16:18 +02:00
|
|
|
{
|
|
|
|
"BSSTMStatus", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
|
|
|
|
wpas_dbus_getter_bss_tm_status,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2015-10-13 18:47:46 +02:00
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
2011-06-13 00:08:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static const struct wpa_dbus_signal_desc wpas_dbus_bss_signals[] = {
|
2011-10-29 18:23:42 +02:00
|
|
|
/* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "PropertiesChanged", WPAS_DBUS_NEW_IFACE_BSS,
|
|
|
|
{
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ NULL, NULL, { END_ARGS } }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_unregister_bss - Unregister a scanned BSS from dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @bssid: scanned network bssid
|
|
|
|
* @id: unique BSS identifier
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Unregisters BSS representing object from dbus
|
|
|
|
*/
|
|
|
|
int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
|
|
|
|
u8 bssid[ETH_ALEN], unsigned int id)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path)
|
2011-06-13 00:08:19 +02:00
|
|
|
return 0;
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, id);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Unregister BSS object '%s'",
|
|
|
|
bss_obj_path);
|
|
|
|
if (wpa_dbus_unregister_object_per_iface(ctrl_iface, bss_obj_path)) {
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Cannot unregister BSS object %s",
|
|
|
|
bss_obj_path);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpas_dbus_signal_bss_removed(wpa_s, bss_obj_path);
|
|
|
|
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSSS);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_register_bss - Register a scanned BSS with dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @bssid: scanned network bssid
|
|
|
|
* @id: unique BSS identifier
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Registers BSS representing object with dbus
|
|
|
|
*/
|
|
|
|
int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
|
|
|
|
u8 bssid[ETH_ALEN], unsigned int id)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
struct wpa_dbus_object_desc *obj_desc;
|
|
|
|
char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
struct bss_handler_args *arg;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path)
|
2011-06-13 00:08:19 +02:00
|
|
|
return 0;
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, id);
|
|
|
|
|
|
|
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
|
|
|
if (!obj_desc) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create object description");
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
arg = os_zalloc(sizeof(struct bss_handler_args));
|
|
|
|
if (!arg) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create arguments for handler");
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
arg->wpa_s = wpa_s;
|
|
|
|
arg->id = id;
|
|
|
|
|
|
|
|
wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL,
|
|
|
|
wpas_dbus_bss_properties,
|
|
|
|
wpas_dbus_bss_signals);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Register BSS object '%s'",
|
|
|
|
bss_obj_path);
|
|
|
|
if (wpa_dbus_register_object_per_iface(ctrl_iface, bss_obj_path,
|
|
|
|
wpa_s->ifname, obj_desc)) {
|
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Cannot register BSSID dbus object %s.",
|
|
|
|
bss_obj_path);
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpas_dbus_signal_bss_added(wpa_s, bss_obj_path);
|
|
|
|
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSSS);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
free_dbus_object_desc(obj_desc);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-10-07 14:31:51 +02:00
|
|
|
static const struct wpa_dbus_property_desc wpas_dbus_sta_properties[] = {
|
|
|
|
{ "Address", WPAS_DBUS_NEW_IFACE_STA, "ay",
|
|
|
|
wpas_dbus_getter_sta_address,
|
|
|
|
NULL, NULL
|
|
|
|
},
|
|
|
|
{ "AID", WPAS_DBUS_NEW_IFACE_STA, "q",
|
|
|
|
wpas_dbus_getter_sta_aid,
|
|
|
|
NULL, NULL
|
|
|
|
},
|
|
|
|
{ "Capabilities", WPAS_DBUS_NEW_IFACE_STA, "q",
|
|
|
|
wpas_dbus_getter_sta_caps,
|
|
|
|
NULL, NULL
|
|
|
|
},
|
|
|
|
{ "RxPackets", WPAS_DBUS_NEW_IFACE_STA, "t",
|
|
|
|
wpas_dbus_getter_sta_rx_packets,
|
|
|
|
NULL, NULL
|
|
|
|
},
|
|
|
|
{ "TxPackets", WPAS_DBUS_NEW_IFACE_STA, "t",
|
|
|
|
wpas_dbus_getter_sta_tx_packets,
|
|
|
|
NULL, NULL
|
|
|
|
},
|
|
|
|
{ "RxBytes", WPAS_DBUS_NEW_IFACE_STA, "t",
|
|
|
|
wpas_dbus_getter_sta_rx_bytes,
|
|
|
|
NULL, NULL
|
|
|
|
},
|
|
|
|
{ "TxBytes", WPAS_DBUS_NEW_IFACE_STA, "t",
|
|
|
|
wpas_dbus_getter_sta_tx_bytes,
|
|
|
|
NULL, NULL
|
|
|
|
},
|
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static const struct wpa_dbus_signal_desc wpas_dbus_sta_signals[] = {
|
|
|
|
/* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
|
|
|
|
{ "PropertiesChanged", WPAS_DBUS_NEW_IFACE_STA,
|
|
|
|
{
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ NULL, NULL, { END_ARGS } }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_unregister_sta - Unregister a connected station from dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @sta: station MAC address
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Unregisters STA representing object from dbus.
|
|
|
|
*/
|
|
|
|
int wpas_dbus_unregister_sta(struct wpa_supplicant *wpa_s, const u8 *sta)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
char station_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (!wpa_s || !wpa_s->global)
|
|
|
|
return 0;
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (!ctrl_iface)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
os_snprintf(station_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_STAS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(sta));
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Unregister STA object '%s'",
|
|
|
|
station_obj_path);
|
|
|
|
if (wpa_dbus_unregister_object_per_iface(ctrl_iface,
|
|
|
|
station_obj_path)) {
|
|
|
|
wpa_printf(MSG_ERROR, "dbus: Cannot unregister STA object %s",
|
|
|
|
station_obj_path);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpas_dbus_signal_station_removed(wpa_s, station_obj_path);
|
|
|
|
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATIONS);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_register_sta - Register a connected station with dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @sta: station MAC address
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Registers STA representing object with dbus.
|
|
|
|
*/
|
|
|
|
int wpas_dbus_register_sta(struct wpa_supplicant *wpa_s, const u8 *sta)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
struct wpa_dbus_object_desc *obj_desc;
|
|
|
|
char station_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
struct sta_handler_args *arg;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (!wpa_s || !wpa_s->global)
|
|
|
|
return 0;
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (!ctrl_iface)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
os_snprintf(station_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_STAS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(sta));
|
|
|
|
|
|
|
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
|
|
|
if (!obj_desc) {
|
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create object description");
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
arg = os_zalloc(sizeof(struct sta_handler_args));
|
|
|
|
if (!arg) {
|
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create arguments for handler");
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
arg->wpa_s = wpa_s;
|
|
|
|
arg->sta = sta;
|
|
|
|
|
|
|
|
wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL,
|
|
|
|
wpas_dbus_sta_properties, wpas_dbus_sta_signals);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Register STA object '%s'",
|
|
|
|
station_obj_path);
|
|
|
|
if (wpa_dbus_register_object_per_iface(ctrl_iface, station_obj_path,
|
|
|
|
wpa_s->ifname, obj_desc)) {
|
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Cannot register STA dbus object %s",
|
|
|
|
station_obj_path);
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpas_dbus_signal_station_added(wpa_s, station_obj_path);
|
|
|
|
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATIONS);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
free_dbus_object_desc(obj_desc);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
|
|
|
|
{ "Scan", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_scan,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2014-09-10 19:34:56 +02:00
|
|
|
{ "SignalPoll", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_signal_poll,
|
2014-09-10 19:34:56 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "Disconnect", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_disconnect,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "AddNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_add_network,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2012-08-09 12:54:36 +02:00
|
|
|
{ "Reassociate", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_reassociate,
|
2012-08-09 12:54:36 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2014-03-06 19:06:04 +01:00
|
|
|
{ "Reattach", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_reattach,
|
2014-03-06 19:06:04 +01:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-06-12 13:27:19 +02:00
|
|
|
{ "Reconnect", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_reconnect,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "RemoveNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_remove_network,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "path", "o", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "RemoveAllNetworks", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_remove_all_networks,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "SelectNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_select_network,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "path", "o", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-10-24 18:09:06 +02:00
|
|
|
{ "NetworkReply", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_network_reply,
|
2011-10-24 18:09:06 +02:00
|
|
|
{
|
|
|
|
{ "path", "o", ARG_IN },
|
|
|
|
{ "field", "s", ARG_IN },
|
|
|
|
{ "value", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2013-03-16 11:20:21 +01:00
|
|
|
#ifndef CONFIG_NO_CONFIG_BLOBS
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "AddBlob", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_add_blob,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "name", "s", ARG_IN },
|
|
|
|
{ "data", "ay", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "GetBlob", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_get_blob,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "name", "s", ARG_IN },
|
|
|
|
{ "data", "ay", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "RemoveBlob", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_remove_blob,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "name", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2013-03-16 11:20:21 +01:00
|
|
|
#endif /* CONFIG_NO_CONFIG_BLOBS */
|
2013-11-23 09:38:07 +01:00
|
|
|
{ "SetPKCS11EngineAndModulePath", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler)
|
2014-12-31 22:21:10 +01:00
|
|
|
wpas_dbus_handler_set_pkcs11_engine_and_module_path,
|
2013-11-23 09:38:07 +01:00
|
|
|
{
|
|
|
|
{ "pkcs11_engine_path", "s", ARG_IN },
|
|
|
|
{ "pkcs11_module_path", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
#ifdef CONFIG_WPS
|
|
|
|
{ "Start", WPAS_DBUS_NEW_IFACE_WPS,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_wps_start,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
{ "output", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-05-26 06:08:39 +02:00
|
|
|
{ "Cancel", WPAS_DBUS_NEW_IFACE_WPS,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_wps_cancel,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
#endif /* CONFIG_WPS */
|
|
|
|
#ifdef CONFIG_P2P
|
|
|
|
{ "Find", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_find,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "StopFind", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_stop_find,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "Listen", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_listen,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "timeout", "i", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ExtendedListen", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_extendedlisten,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "PresenceRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_presence_request,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ProvisionDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_prov_disc_req,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "peer", "o", ARG_IN },
|
|
|
|
{ "config_method", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "Connect", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_connect,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
2011-09-13 18:27:29 +02:00
|
|
|
{ "generated_pin", "s", ARG_OUT },
|
2011-06-13 00:08:19 +02:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "GroupAdd", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_group_add,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-05-26 07:05:47 +02:00
|
|
|
{ "Cancel", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_cancel,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "Invite", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_invite,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "Disconnect", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_disconnect,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "RejectPeer", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_rejectpeer,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "peer", "o", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-06-16 13:35:56 +02:00
|
|
|
{ "RemoveClient", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_remove_client,
|
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "Flush", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_flush,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "AddService", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_add_service,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "DeleteService", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_delete_service,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "FlushService", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_flush_service,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ServiceDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_service_sd_req,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
2014-03-21 12:48:06 +01:00
|
|
|
{ "ref", "t", ARG_OUT },
|
2011-06-13 00:08:19 +02:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ServiceDiscoveryResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_service_sd_res,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ServiceDiscoveryCancelRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_service_sd_cancel_req,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "args", "t", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ServiceUpdate", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_service_update,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ServiceDiscoveryExternal", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_p2p_serv_disc_external,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "arg", "i", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-24 10:20:19 +02:00
|
|
|
{ "AddPersistentGroup", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_add_persistent_group,
|
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "RemovePersistentGroup", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_remove_persistent_group,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "RemoveAllPersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
(WPADBusMethodHandler)
|
|
|
|
wpas_dbus_handler_remove_all_persistent_groups,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
#endif /* CONFIG_P2P */
|
|
|
|
{ "FlushBSS", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_flush_bss,
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
{ "age", "u", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2012-04-01 20:13:38 +02:00
|
|
|
#ifdef CONFIG_AP
|
|
|
|
{ "SubscribeProbeReq", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_subscribe_preq,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "UnsubscribeProbeReq", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_unsubscribe_preq,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif /* CONFIG_AP */
|
2013-04-23 16:57:55 +02:00
|
|
|
{ "EAPLogoff", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_eap_logoff,
|
2013-04-23 16:57:55 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "EAPLogon", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_eap_logon,
|
2013-04-23 16:57:55 +02:00
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2013-07-01 18:11:34 +02:00
|
|
|
#ifdef CONFIG_AUTOSCAN
|
|
|
|
{ "AutoScan", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
2014-12-31 22:21:10 +01:00
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_autoscan,
|
2013-07-01 18:11:34 +02:00
|
|
|
{
|
|
|
|
{ "arg", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif /* CONFIG_AUTOSCAN */
|
2013-11-11 21:13:55 +01:00
|
|
|
#ifdef CONFIG_TDLS
|
|
|
|
{ "TDLSDiscover", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_tdls_discover,
|
|
|
|
{
|
|
|
|
{ "peer_address", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "TDLSSetup", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_tdls_setup,
|
|
|
|
{
|
|
|
|
{ "peer_address", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "TDLSStatus", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_tdls_status,
|
|
|
|
{
|
|
|
|
{ "peer_address", "s", ARG_IN },
|
|
|
|
{ "status", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "TDLSTeardown", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_tdls_teardown,
|
|
|
|
{
|
|
|
|
{ "peer_address", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2017-05-01 06:05:37 +02:00
|
|
|
{ "TDLSChannelSwitch", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_tdls_channel_switch,
|
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2017-04-13 14:09:01 +02:00
|
|
|
{ "TDLSCancelChannelSwitch", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_tdls_cancel_channel_switch,
|
|
|
|
{
|
|
|
|
{ "peer_address", "s", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2013-11-11 21:13:55 +01:00
|
|
|
#endif /* CONFIG_TDLS */
|
2015-12-04 06:27:27 +01:00
|
|
|
{ "VendorElemAdd", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_vendor_elem_add,
|
|
|
|
{
|
|
|
|
{ "frame_id", "i", ARG_IN },
|
|
|
|
{ "ielems", "ay", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "VendorElemGet", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_vendor_elem_get,
|
|
|
|
{
|
|
|
|
{ "frame_id", "i", ARG_IN },
|
|
|
|
{ "ielems", "ay", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "VendorElemRem", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_vendor_elem_remove,
|
|
|
|
{
|
|
|
|
{ "frame_id", "i", ARG_IN },
|
|
|
|
{ "ielems", "ay", ARG_IN },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-11-03 08:01:27 +01:00
|
|
|
#ifndef CONFIG_NO_CONFIG_WRITE
|
|
|
|
{ "SaveConfig", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_save_config,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif /* CONFIG_NO_CONFIG_WRITE */
|
2017-04-13 05:58:11 +02:00
|
|
|
{ "AbortScan", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
(WPADBusMethodHandler) wpas_dbus_handler_abort_scan,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ NULL, NULL, NULL, { END_ARGS } }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
|
|
|
|
{ "Capabilities", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{sv}",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_capabilities,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "State", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_state,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Scanning", WPAS_DBUS_NEW_IFACE_INTERFACE, "b",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_scanning,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "ApScan", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_ap_scan,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_ap_scan,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "BSSExpireAge", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_expire_age,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_bss_expire_age,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "BSSExpireCount", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bss_expire_count,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_bss_expire_count,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Country", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_country,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_country,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Ifname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_ifname,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Driver", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_driver,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "BridgeIfname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bridge_ifname,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
2016-08-23 14:16:00 +02:00
|
|
|
{ "ConfigFile", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
|
|
|
wpas_dbus_getter_config_file,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "CurrentBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_current_bss,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "CurrentNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, "o",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_current_network,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "CurrentAuthMode", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_current_auth_mode,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Blobs", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{say}",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_blobs,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "BSSs", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_bsss,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Networks", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_networks,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
2012-01-28 10:21:37 +01:00
|
|
|
{ "FastReauth", WPAS_DBUS_NEW_IFACE_INTERFACE, "b",
|
|
|
|
wpas_dbus_getter_fast_reauth,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_fast_reauth,
|
|
|
|
NULL
|
2012-01-28 10:21:37 +01:00
|
|
|
},
|
2012-04-01 17:05:22 +02:00
|
|
|
{ "ScanInterval", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
|
|
|
|
wpas_dbus_getter_scan_interval,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_scan_interval,
|
|
|
|
NULL
|
2012-04-01 17:05:22 +02:00
|
|
|
},
|
2013-11-23 09:38:07 +01:00
|
|
|
{ "PKCS11EnginePath", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
|
|
|
wpas_dbus_getter_pkcs11_engine_path,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2013-11-23 09:38:07 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "PKCS11ModulePath", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
|
|
|
wpas_dbus_getter_pkcs11_module_path,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2013-11-23 09:38:07 +01:00
|
|
|
NULL
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
#ifdef CONFIG_WPS
|
|
|
|
{ "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_process_credentials,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_process_credentials,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
2014-10-03 08:10:33 +02:00
|
|
|
{ "ConfigMethods", WPAS_DBUS_NEW_IFACE_WPS, "s",
|
|
|
|
wpas_dbus_getter_config_methods,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_config_methods,
|
|
|
|
NULL
|
2014-10-03 08:10:33 +02:00
|
|
|
},
|
2016-12-21 13:24:20 +01:00
|
|
|
{
|
|
|
|
"DeviceName", WPAS_DBUS_NEW_IFACE_WPS, "s",
|
|
|
|
wpas_dbus_getter_wps_device_name,
|
|
|
|
wpas_dbus_setter_wps_device_name,
|
|
|
|
NULL
|
|
|
|
},
|
2016-12-21 13:24:21 +01:00
|
|
|
{
|
|
|
|
"Manufacturer", WPAS_DBUS_NEW_IFACE_WPS, "s",
|
|
|
|
wpas_dbus_getter_wps_manufacturer,
|
|
|
|
wpas_dbus_setter_wps_manufacturer,
|
|
|
|
NULL
|
|
|
|
},
|
2016-12-21 13:24:22 +01:00
|
|
|
{
|
|
|
|
"ModelName", WPAS_DBUS_NEW_IFACE_WPS, "s",
|
|
|
|
wpas_dbus_getter_wps_device_model_name,
|
|
|
|
wpas_dbus_setter_wps_device_model_name,
|
|
|
|
NULL
|
|
|
|
},
|
2016-12-21 13:24:23 +01:00
|
|
|
{
|
|
|
|
"ModelNumber", WPAS_DBUS_NEW_IFACE_WPS, "s",
|
|
|
|
wpas_dbus_getter_wps_device_model_number,
|
|
|
|
wpas_dbus_setter_wps_device_model_number,
|
|
|
|
NULL
|
|
|
|
},
|
2016-12-21 13:24:24 +01:00
|
|
|
{
|
|
|
|
"SerialNumber", WPAS_DBUS_NEW_IFACE_WPS, "s",
|
|
|
|
wpas_dbus_getter_wps_device_serial_number,
|
|
|
|
wpas_dbus_setter_wps_device_serial_number,
|
|
|
|
NULL
|
|
|
|
},
|
2016-12-21 13:24:25 +01:00
|
|
|
{
|
|
|
|
"DeviceType", WPAS_DBUS_NEW_IFACE_WPS, "ay",
|
|
|
|
wpas_dbus_getter_wps_device_device_type,
|
|
|
|
wpas_dbus_setter_wps_device_device_type,
|
|
|
|
NULL
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
#endif /* CONFIG_WPS */
|
|
|
|
#ifdef CONFIG_P2P
|
2012-04-14 19:52:59 +02:00
|
|
|
{ "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}",
|
|
|
|
wpas_dbus_getter_p2p_device_config,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_p2p_device_config,
|
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Peers", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_p2p_peers,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Role", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "s",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_p2p_role,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "Group", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_p2p_group,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
|
|
|
{ "PeerGO", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_p2p_peergo,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-13 00:08:19 +02:00
|
|
|
},
|
2011-06-24 10:20:19 +02:00
|
|
|
{ "PersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_persistent_groups,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2011-06-23 20:25:13 +02:00
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
#endif /* CONFIG_P2P */
|
2012-06-30 15:43:50 +02:00
|
|
|
{ "DisconnectReason", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
|
|
|
|
wpas_dbus_getter_disconnect_reason,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-06-30 15:43:50 +02:00
|
|
|
NULL
|
|
|
|
},
|
2018-07-06 01:29:09 +02:00
|
|
|
{ "AuthStatusCode", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
|
|
|
|
wpas_dbus_getter_auth_status_code,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2016-03-03 19:48:09 +01:00
|
|
|
{ "AssocStatusCode", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
|
|
|
|
wpas_dbus_getter_assoc_status_code,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2017-07-18 09:07:56 +02:00
|
|
|
#ifdef CONFIG_MESH
|
|
|
|
{ "MeshPeers", WPAS_DBUS_NEW_IFACE_MESH, "aay",
|
|
|
|
wpas_dbus_getter_mesh_peers,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2017-07-18 09:07:57 +02:00
|
|
|
{ "MeshGroup", WPAS_DBUS_NEW_IFACE_MESH, "ay",
|
|
|
|
wpas_dbus_getter_mesh_group,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2017-07-18 09:07:56 +02:00
|
|
|
#endif /* CONFIG_MESH */
|
2018-10-07 14:31:51 +02:00
|
|
|
{ "Stations", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao",
|
|
|
|
wpas_dbus_getter_stas,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2015-10-13 18:47:46 +02:00
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
2011-06-13 00:08:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
|
|
|
|
{ "ScanDone", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "success", "b", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "BSSAdded", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "BSSRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "BlobAdded", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "name", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "BlobRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "name", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "NetworkAdded", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "NetworkRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "NetworkSelected", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-10-29 18:23:42 +02:00
|
|
|
/* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "PropertiesChanged", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#ifdef CONFIG_WPS
|
|
|
|
{ "Event", WPAS_DBUS_NEW_IFACE_WPS,
|
|
|
|
{
|
|
|
|
{ "name", "s", ARG_OUT },
|
|
|
|
{ "args", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "Credentials", WPAS_DBUS_NEW_IFACE_WPS,
|
|
|
|
{
|
|
|
|
{ "credentials", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-10-29 18:23:42 +02:00
|
|
|
/* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "PropertiesChanged", WPAS_DBUS_NEW_IFACE_WPS,
|
|
|
|
{
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif /* CONFIG_WPS */
|
|
|
|
#ifdef CONFIG_P2P
|
|
|
|
{ "DeviceFound", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2016-06-20 06:48:21 +02:00
|
|
|
{ "DeviceFoundProperties", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "DeviceLost", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-05-13 14:03:48 +02:00
|
|
|
{ "FindStopped", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "ProvisionDiscoveryRequestDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "peer_object", "o", ARG_OUT },
|
|
|
|
{ "pin", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ProvisionDiscoveryResponseDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "peer_object", "o", ARG_OUT },
|
|
|
|
{ "pin", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ProvisionDiscoveryRequestEnterPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "peer_object", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ProvisionDiscoveryResponseEnterPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "peer_object", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ProvisionDiscoveryPBCRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "peer_object", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ProvisionDiscoveryPBCResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "peer_object", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "ProvisionDiscoveryFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "peer_object", "o", ARG_OUT },
|
|
|
|
{ "status", "i", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "GroupStarted", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2009-11-14 17:18:07 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-08-20 12:58:33 +02:00
|
|
|
{ "GroupFormationFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "reason", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "GONegotiationSuccess", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2011-03-20 11:12:12 +01:00
|
|
|
{
|
2014-05-14 15:10:38 +02:00
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
2011-03-20 11:12:12 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "GONegotiationFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2009-11-14 17:18:07 +01:00
|
|
|
{
|
2014-05-14 15:10:38 +02:00
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "GONegotiationRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2009-11-14 17:18:07 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "path", "o", ARG_OUT },
|
2015-09-17 14:46:03 +02:00
|
|
|
{ "dev_passwd_id", "q", ARG_OUT },
|
2015-06-02 07:47:33 +02:00
|
|
|
{ "device_go_intent", "y", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "InvitationResult", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2009-11-14 17:18:07 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "invite_result", "a{sv}", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "GroupFinished", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2009-11-14 17:18:07 +01:00
|
|
|
{
|
2014-07-08 14:56:11 +02:00
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "ServiceDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2009-11-14 17:18:07 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "sd_request", "a{sv}", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "ServiceDiscoveryResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2011-03-20 11:02:33 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "sd_response", "a{sv}", ARG_OUT },
|
2011-03-20 11:02:33 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-23 20:25:13 +02:00
|
|
|
{ "PersistentGroupAdded", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-07-04 19:24:45 +02:00
|
|
|
{ "PersistentGroupRemoved", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-25 10:47:04 +02:00
|
|
|
{ "WpsFailed", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "name", "s", ARG_OUT },
|
|
|
|
{ "args", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-06-18 06:16:34 +02:00
|
|
|
{ "InvitationReceived", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
{
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
#endif /* CONFIG_P2P */
|
2012-04-01 20:13:38 +02:00
|
|
|
#ifdef CONFIG_AP
|
|
|
|
{ "ProbeRequest", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif /* CONFIG_AP */
|
2011-07-05 11:22:32 +02:00
|
|
|
{ "Certification", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "certification", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2012-06-04 20:10:01 +02:00
|
|
|
{ "EAP", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "status", "s", ARG_OUT },
|
|
|
|
{ "parameter", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2013-06-22 11:09:09 +02:00
|
|
|
{ "StaAuthorized", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "name", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "StaDeauthorized", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "name", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2018-10-07 14:31:51 +02:00
|
|
|
{ "StationAdded", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ "StationRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2015-01-02 15:11:56 +01:00
|
|
|
{ "NetworkRequest", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
|
|
{
|
|
|
|
{ "path", "o", ARG_OUT },
|
|
|
|
{ "field", "s", ARG_OUT },
|
|
|
|
{ "text", "s", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2017-07-18 09:07:51 +02:00
|
|
|
#ifdef CONFIG_MESH
|
|
|
|
{ "MeshGroupStarted", WPAS_DBUS_NEW_IFACE_MESH,
|
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2017-07-18 09:07:53 +02:00
|
|
|
{ "MeshGroupRemoved", WPAS_DBUS_NEW_IFACE_MESH,
|
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2017-07-18 09:07:54 +02:00
|
|
|
{ "MeshPeerConnected", WPAS_DBUS_NEW_IFACE_MESH,
|
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2017-07-18 09:07:55 +02:00
|
|
|
{ "MeshPeerDisconnected", WPAS_DBUS_NEW_IFACE_MESH,
|
|
|
|
{
|
|
|
|
{ "args", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2017-07-18 09:07:51 +02:00
|
|
|
#endif /* CONFIG_MESH */
|
2011-06-13 00:08:19 +02:00
|
|
|
{ NULL, NULL, { END_ARGS } }
|
2009-11-14 17:18:07 +01:00
|
|
|
};
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
|
2015-10-13 18:47:46 +02:00
|
|
|
static int wpa_dbus_ctrl_iface_props_init(struct wpas_dbus_priv *priv)
|
|
|
|
{
|
|
|
|
size_t all_size;
|
|
|
|
unsigned int i, j, count, num_const, num_globals;
|
|
|
|
const char *global_name;
|
|
|
|
static const char * const ignored_globals[] = {
|
|
|
|
"bss_expiration_age", "bss_expiration_scan_count",
|
|
|
|
"ap_scan", "country", "fast_reauth",
|
|
|
|
"pkcs11_engine_path", "pkcs11_module_path"
|
|
|
|
};
|
|
|
|
|
|
|
|
/* wpas_dbus_interface_properties terminates with a NULL element */
|
|
|
|
num_const = ARRAY_SIZE(wpas_dbus_interface_properties) - 1;
|
|
|
|
|
|
|
|
num_globals = wpa_config_get_num_global_field_names();
|
|
|
|
priv->globals_start = num_const;
|
|
|
|
|
|
|
|
/* allocate enough for all properties + terminating NULL element */
|
|
|
|
all_size = (num_globals + num_const + 1) *
|
|
|
|
sizeof(wpas_dbus_interface_properties[0]);
|
|
|
|
priv->all_interface_properties = os_zalloc(all_size);
|
|
|
|
if (!priv->all_interface_properties) {
|
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"dbus: Not enough memory for interface properties");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy constant interface properties to the start of the array */
|
|
|
|
os_memcpy(priv->all_interface_properties,
|
|
|
|
wpas_dbus_interface_properties,
|
|
|
|
sizeof(wpas_dbus_interface_properties));
|
|
|
|
|
|
|
|
/* Dynamically construct interface global properties */
|
|
|
|
for (i = 0, count = num_const; i < num_globals; i++) {
|
|
|
|
struct wpa_dbus_property_desc *desc;
|
|
|
|
int no_var = 0;
|
|
|
|
|
|
|
|
/* ignore globals that are actually just methods */
|
|
|
|
global_name = wpa_config_get_global_field_name(i, &no_var);
|
|
|
|
if (no_var)
|
|
|
|
continue;
|
|
|
|
/* Ignore fields already explicitly exposed */
|
|
|
|
for (j = 0; j < ARRAY_SIZE(ignored_globals); j++) {
|
|
|
|
if (os_strcmp(global_name, ignored_globals[j]) == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (j < ARRAY_SIZE(ignored_globals))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
desc = &priv->all_interface_properties[count++];
|
|
|
|
desc->dbus_property = uscore_to_dbus(global_name);
|
|
|
|
if (!desc->dbus_property) {
|
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"dbus: Not enough memory for D-Bus property name");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
desc->dbus_interface = WPAS_DBUS_NEW_IFACE_INTERFACE;
|
|
|
|
desc->type = "s";
|
|
|
|
desc->getter = wpas_dbus_getter_iface_global;
|
|
|
|
desc->setter = wpas_dbus_setter_iface_global;
|
|
|
|
desc->data = global_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
|
|
|
wpa_dbus_ctrl_iface_props_deinit(priv);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-22 06:05:08 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_register_interface - Register an interface with D-Bus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
struct wpa_dbus_object_desc *obj_desc = NULL;
|
|
|
|
struct wpas_dbus_priv *ctrl_iface = wpa_s->global->dbus;
|
|
|
|
int next;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Create and set the interface's object path */
|
|
|
|
wpa_s->dbus_new_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
|
|
|
if (wpa_s->dbus_new_path == NULL)
|
|
|
|
return -1;
|
|
|
|
next = ctrl_iface->next_objid++;
|
|
|
|
os_snprintf(wpa_s->dbus_new_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
WPAS_DBUS_NEW_PATH_INTERFACES "/%u",
|
|
|
|
next);
|
|
|
|
|
|
|
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
|
|
|
if (!obj_desc) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create object description");
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpas_dbus_register(obj_desc, wpa_s, NULL, wpas_dbus_interface_methods,
|
2015-10-13 18:47:46 +02:00
|
|
|
ctrl_iface->all_interface_properties,
|
2011-06-13 00:08:19 +02:00
|
|
|
wpas_dbus_interface_signals);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Register interface object '%s'",
|
|
|
|
wpa_s->dbus_new_path);
|
|
|
|
if (wpa_dbus_register_object_per_iface(ctrl_iface,
|
|
|
|
wpa_s->dbus_new_path,
|
|
|
|
wpa_s->ifname, obj_desc))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
wpas_dbus_signal_interface_added(wpa_s);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
os_free(wpa_s->dbus_new_path);
|
|
|
|
wpa_s->dbus_new_path = NULL;
|
|
|
|
free_dbus_object_desc(obj_desc);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-22 06:08:39 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_unregister_interface - Unregister the interface from D-Bus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*/
|
2011-06-13 00:08:19 +02:00
|
|
|
int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL)
|
|
|
|
return 0;
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
2015-01-06 22:13:28 +01:00
|
|
|
if (ctrl_iface == NULL || wpa_s->dbus_new_path == NULL)
|
2011-06-13 00:08:19 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Unregister interface object '%s'",
|
|
|
|
wpa_s->dbus_new_path);
|
2012-04-01 20:13:38 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_AP
|
|
|
|
if (wpa_s->preq_notify_peer) {
|
|
|
|
wpas_dbus_unsubscribe_noc(ctrl_iface);
|
|
|
|
os_free(wpa_s->preq_notify_peer);
|
|
|
|
wpa_s->preq_notify_peer = NULL;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_AP */
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
if (wpa_dbus_unregister_object_per_iface(ctrl_iface,
|
|
|
|
wpa_s->dbus_new_path))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
wpas_dbus_signal_interface_removed(wpa_s);
|
|
|
|
|
|
|
|
os_free(wpa_s->dbus_new_path);
|
|
|
|
wpa_s->dbus_new_path = NULL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_P2P
|
|
|
|
|
|
|
|
static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
|
2012-02-11 10:36:50 +01:00
|
|
|
{ "DeviceName", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s",
|
|
|
|
wpas_dbus_getter_p2p_peer_device_name,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-02-11 10:36:50 +01:00
|
|
|
NULL
|
|
|
|
},
|
2015-05-28 14:19:46 +02:00
|
|
|
{ "Manufacturer", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s",
|
|
|
|
wpas_dbus_getter_p2p_peer_manufacturer,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2015-05-28 14:19:46 +02:00
|
|
|
NULL
|
|
|
|
},
|
2015-06-10 12:06:09 +02:00
|
|
|
{ "ModelName", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s",
|
|
|
|
wpas_dbus_getter_p2p_peer_modelname,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2015-06-10 12:06:09 +02:00
|
|
|
NULL
|
|
|
|
},
|
2015-06-10 12:06:09 +02:00
|
|
|
{ "ModelNumber", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s",
|
|
|
|
wpas_dbus_getter_p2p_peer_modelnumber,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2015-06-10 12:06:09 +02:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "SerialNumber", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s",
|
|
|
|
wpas_dbus_getter_p2p_peer_serialnumber,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2015-06-10 12:06:09 +02:00
|
|
|
NULL
|
|
|
|
},
|
2012-02-11 10:36:50 +01:00
|
|
|
{ "PrimaryDeviceType", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
|
|
|
|
wpas_dbus_getter_p2p_peer_primary_device_type,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-02-11 10:36:50 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "config_method", WPAS_DBUS_NEW_IFACE_P2P_PEER, "q",
|
|
|
|
wpas_dbus_getter_p2p_peer_config_method,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-02-11 10:36:50 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "level", WPAS_DBUS_NEW_IFACE_P2P_PEER, "i",
|
|
|
|
wpas_dbus_getter_p2p_peer_level,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-02-11 10:36:50 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "devicecapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y",
|
|
|
|
wpas_dbus_getter_p2p_peer_device_capability,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-02-11 10:36:50 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "groupcapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y",
|
|
|
|
wpas_dbus_getter_p2p_peer_group_capability,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-02-11 10:36:50 +01:00
|
|
|
NULL
|
|
|
|
},
|
2012-02-25 09:50:13 +01:00
|
|
|
{ "SecondaryDeviceTypes", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay",
|
2012-02-11 10:36:50 +01:00
|
|
|
wpas_dbus_getter_p2p_peer_secondary_device_types,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-02-11 10:36:50 +01:00
|
|
|
NULL
|
|
|
|
},
|
2012-02-25 09:50:13 +01:00
|
|
|
{ "VendorExtension", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay",
|
2012-02-11 10:36:50 +01:00
|
|
|
wpas_dbus_getter_p2p_peer_vendor_extension,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2009-11-14 17:18:07 +01:00
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "IEs", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_p2p_peer_ies,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2009-11-14 17:18:07 +01:00
|
|
|
},
|
2014-03-21 12:48:07 +01:00
|
|
|
{ "DeviceAddress", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
|
|
|
|
wpas_dbus_getter_p2p_peer_device_address,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2014-03-21 12:48:07 +01:00
|
|
|
NULL
|
|
|
|
},
|
2014-06-02 16:42:05 +02:00
|
|
|
{ "Groups", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ao",
|
|
|
|
wpas_dbus_getter_p2p_peer_groups,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2014-06-02 16:42:05 +02:00
|
|
|
NULL
|
|
|
|
},
|
2018-02-16 13:02:39 +01:00
|
|
|
{ "VSIE", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
|
|
|
|
wpas_dbus_getter_p2p_peer_vsie,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
},
|
2015-10-13 18:47:46 +02:00
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
2011-06-13 00:08:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct wpa_dbus_signal_desc wpas_dbus_p2p_peer_signals[] = {
|
2014-06-02 16:42:08 +02:00
|
|
|
/* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
|
|
|
|
{ "PropertiesChanged", WPAS_DBUS_NEW_IFACE_P2P_PEER,
|
|
|
|
{
|
|
|
|
{ "properties", "a{sv}", ARG_OUT },
|
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ NULL, NULL, { END_ARGS } }
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_peer - Send a peer related event signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @dev: peer device object
|
|
|
|
* @interface: name of the interface emitting this signal.
|
|
|
|
* In case of peer objects, it would be emitted by either
|
|
|
|
* the "interface object" or by "peer objects"
|
|
|
|
* @sig_name: signal name - DeviceFound
|
2016-06-20 06:48:21 +02:00
|
|
|
* @properties: Whether to add a second argument with object properties
|
2011-06-13 00:08:19 +02:00
|
|
|
*
|
2016-06-20 06:48:21 +02:00
|
|
|
* Notify listeners about event related with p2p peer device
|
2011-06-13 00:08:19 +02:00
|
|
|
*/
|
|
|
|
static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dev_addr, const char *interface,
|
2018-10-07 14:31:50 +02:00
|
|
|
const char *sig_name, dbus_bool_t properties)
|
2011-06-13 00:08:19 +02:00
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
DBusMessageIter iter;
|
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (iface == NULL || !wpa_s->dbus_new_path)
|
2011-06-13 00:08:19 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(dev_addr));
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path, interface,
|
|
|
|
sig_name);
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_message_iter_init_append(msg, &iter);
|
|
|
|
path = peer_obj_path;
|
|
|
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
2016-06-20 06:48:21 +02:00
|
|
|
&path) ||
|
|
|
|
(properties && !wpa_dbus_get_object_properties(
|
|
|
|
iface, peer_obj_path, WPAS_DBUS_NEW_IFACE_P2P_PEER,
|
|
|
|
&iter)))
|
2014-12-31 12:57:48 +01:00
|
|
|
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
|
|
|
else
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
2011-06-13 00:08:19 +02:00
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_peer_found - Send a peer found signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2015-06-22 06:13:50 +02:00
|
|
|
* @dev_addr: Peer P2P Device Address
|
2011-06-13 00:08:19 +02:00
|
|
|
*
|
|
|
|
* Notify listeners about find a p2p peer device found
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dev_addr)
|
|
|
|
{
|
|
|
|
wpas_dbus_signal_peer(wpa_s, dev_addr,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2016-06-20 06:48:21 +02:00
|
|
|
"DeviceFound", FALSE);
|
|
|
|
|
|
|
|
wpas_dbus_signal_peer(wpa_s, dev_addr,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"DeviceFoundProperties", TRUE);
|
2011-06-13 00:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_peer_lost - Send a peer lost signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
2015-06-22 06:13:50 +02:00
|
|
|
* @dev_addr: Peer P2P Device Address
|
2011-06-13 00:08:19 +02:00
|
|
|
*
|
|
|
|
* Notify listeners about lost a p2p peer device
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dev_addr)
|
|
|
|
{
|
|
|
|
wpas_dbus_signal_peer(wpa_s, dev_addr,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
2016-06-20 06:48:21 +02:00
|
|
|
"DeviceLost", FALSE);
|
2011-06-13 00:08:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_register_peer - Register a discovered peer object with dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
2015-06-16 07:17:00 +02:00
|
|
|
* @dev_addr: P2P Device Address of the peer
|
2011-06-13 00:08:19 +02:00
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Registers network representing object with dbus
|
|
|
|
*/
|
|
|
|
int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
struct wpa_dbus_object_desc *obj_desc;
|
|
|
|
struct peer_handler_args *arg;
|
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
wpa_s = wpa_s->parent->parent;
|
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return 0;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(dev_addr));
|
|
|
|
|
|
|
|
wpa_printf(MSG_INFO, "dbus: Register peer object '%s'",
|
|
|
|
peer_obj_path);
|
|
|
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
|
|
|
if (!obj_desc) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create object description");
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* allocate memory for handlers arguments */
|
|
|
|
arg = os_zalloc(sizeof(struct peer_handler_args));
|
|
|
|
if (!arg) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create arguments for method");
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
arg->wpa_s = wpa_s;
|
|
|
|
os_memcpy(arg->p2p_device_addr, dev_addr, ETH_ALEN);
|
|
|
|
|
|
|
|
wpas_dbus_register(obj_desc, arg, wpa_dbus_free,
|
|
|
|
NULL,
|
|
|
|
wpas_dbus_p2p_peer_properties,
|
|
|
|
wpas_dbus_p2p_peer_signals);
|
|
|
|
|
|
|
|
if (wpa_dbus_register_object_per_iface(ctrl_iface, peer_obj_path,
|
|
|
|
wpa_s->ifname, obj_desc))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
free_dbus_object_desc(obj_desc);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_unregister_peer - Unregister a peer object with dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @dev_addr: p2p device addr
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Registers network representing object with dbus
|
|
|
|
*/
|
|
|
|
int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dev_addr)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL)
|
2011-06-13 00:08:19 +02:00
|
|
|
return 0;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
wpa_s = wpa_s->parent->parent;
|
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return 0;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(dev_addr));
|
|
|
|
|
|
|
|
wpa_printf(MSG_INFO, "dbus: Unregister peer object '%s'",
|
|
|
|
peer_obj_path);
|
|
|
|
ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, peer_obj_path);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-13 14:03:48 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_p2p_find_stopped - Send P2P Find stopped signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
*
|
|
|
|
* Notify listeners about P2P Find stopped
|
|
|
|
*/
|
|
|
|
void wpas_dbus_signal_p2p_find_stopped(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *iface;
|
|
|
|
DBusMessage *msg;
|
|
|
|
|
|
|
|
iface = wpa_s->global->dbus;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2018-02-12 20:27:20 +01:00
|
|
|
if (iface == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
|
|
|
if (!wpa_s->dbus_new_path)
|
2015-05-13 14:03:48 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
|
|
|
|
"FindStopped");
|
|
|
|
if (msg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dbus_connection_send(iface->con, msg, NULL);
|
|
|
|
|
|
|
|
dbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-22 06:25:02 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_signal_peer_groups_changed - Send peer group change property signal
|
|
|
|
* @wpa_s: %wpa_supplicant network interface data
|
|
|
|
* @dev_addr: P2P Device Address
|
|
|
|
*
|
|
|
|
* Notify listeners about peer Groups property changes.
|
|
|
|
*/
|
2014-06-02 16:42:08 +02:00
|
|
|
void wpas_dbus_signal_peer_groups_changed(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dev_addr)
|
|
|
|
{
|
|
|
|
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return;
|
2014-06-02 16:42:08 +02:00
|
|
|
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
|
|
|
|
wpa_s->dbus_new_path, MAC2STR(dev_addr));
|
|
|
|
|
|
|
|
wpa_dbus_mark_property_changed(wpa_s->global->dbus, peer_obj_path,
|
|
|
|
WPAS_DBUS_NEW_IFACE_P2P_PEER, "Groups");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
static const struct wpa_dbus_property_desc wpas_dbus_p2p_group_properties[] = {
|
|
|
|
{ "Members", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ao",
|
2011-07-29 20:25:39 +02:00
|
|
|
wpas_dbus_getter_p2p_group_members,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2011-08-07 10:16:05 +02:00
|
|
|
NULL
|
2009-11-14 17:18:07 +01:00
|
|
|
},
|
2012-03-05 16:25:08 +01:00
|
|
|
{ "Group", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "o",
|
|
|
|
wpas_dbus_getter_p2p_group,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-03-05 16:25:08 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "Role", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s",
|
|
|
|
wpas_dbus_getter_p2p_role,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-03-05 16:25:08 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "SSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
|
|
|
|
wpas_dbus_getter_p2p_group_ssid,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-03-05 16:25:08 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "BSSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
|
|
|
|
wpas_dbus_getter_p2p_group_bssid,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-03-05 16:25:08 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "Frequency", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "q",
|
|
|
|
wpas_dbus_getter_p2p_group_frequency,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-03-05 16:25:08 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "Passphrase", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s",
|
|
|
|
wpas_dbus_getter_p2p_group_passphrase,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-03-05 16:25:08 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "PSK", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
|
|
|
|
wpas_dbus_getter_p2p_group_psk,
|
2015-10-13 18:47:46 +02:00
|
|
|
NULL,
|
2012-03-05 16:25:08 +01:00
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{ "WPSVendorExtensions", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "aay",
|
|
|
|
wpas_dbus_getter_p2p_group_vendor_ext,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_p2p_group_vendor_ext,
|
|
|
|
NULL
|
2009-11-14 17:18:07 +01:00
|
|
|
},
|
2015-10-13 18:47:46 +02:00
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
2009-11-14 17:18:07 +01:00
|
|
|
};
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
static const struct wpa_dbus_signal_desc wpas_dbus_p2p_group_signals[] = {
|
|
|
|
{ "PeerJoined", WPAS_DBUS_NEW_IFACE_P2P_GROUP,
|
2009-11-14 17:18:07 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "peer", "o", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "PeerDisconnected", WPAS_DBUS_NEW_IFACE_P2P_GROUP,
|
2009-11-14 17:18:07 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
{ "peer", "o", ARG_OUT },
|
2009-11-14 17:18:07 +01:00
|
|
|
END_ARGS
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ NULL, NULL, { END_ARGS } }
|
|
|
|
};
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/**
|
|
|
|
* wpas_dbus_register_p2p_group - Register a p2p group object with dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @ssid: SSID struct
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Registers p2p group representing object with dbus
|
|
|
|
*/
|
|
|
|
void wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_ssid *ssid)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
struct wpa_dbus_object_desc *obj_desc;
|
|
|
|
char group_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
2009-11-14 17:18:07 +01:00
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (wpa_s->dbus_groupobj_path) {
|
|
|
|
wpa_printf(MSG_INFO, "%s: Group object '%s' already exists",
|
|
|
|
__func__, wpa_s->dbus_groupobj_path);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wpas_dbus_get_group_obj_path(wpa_s, ssid, group_obj_path) < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
wpa_s->dbus_groupobj_path = os_strdup(group_obj_path);
|
|
|
|
if (wpa_s->dbus_groupobj_path == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
wpa_printf(MSG_INFO, "dbus: Register group object '%s'",
|
|
|
|
group_obj_path);
|
|
|
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
|
|
|
if (!obj_desc) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Not enough memory to create object description");
|
2011-06-13 00:08:19 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpas_dbus_register(obj_desc, wpa_s, NULL, NULL,
|
|
|
|
wpas_dbus_p2p_group_properties,
|
|
|
|
wpas_dbus_p2p_group_signals);
|
|
|
|
|
|
|
|
if (wpa_dbus_register_object_per_iface(ctrl_iface, group_obj_path,
|
|
|
|
wpa_s->ifname, obj_desc))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
err:
|
|
|
|
if (wpa_s->dbus_groupobj_path) {
|
|
|
|
os_free(wpa_s->dbus_groupobj_path);
|
|
|
|
wpa_s->dbus_groupobj_path = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
free_dbus_object_desc(obj_desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_unregister_p2p_group - Unregister a p2p group object from dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @ssid: network name of the p2p group started
|
|
|
|
*/
|
|
|
|
void wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
|
|
|
|
const struct wpa_ssid *ssid)
|
2009-11-09 22:51:59 +01:00
|
|
|
{
|
2011-06-13 00:08:19 +02:00
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL)
|
|
|
|
return;
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!wpa_s->dbus_groupobj_path) {
|
|
|
|
wpa_printf(MSG_DEBUG,
|
2019-10-18 04:04:19 +02:00
|
|
|
"%s: Group object has already unregistered",
|
|
|
|
__func__);
|
2011-06-13 00:08:19 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-02 16:42:08 +02:00
|
|
|
peer_groups_changed(wpa_s);
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Unregister group object '%s'",
|
|
|
|
wpa_s->dbus_groupobj_path);
|
|
|
|
|
|
|
|
wpa_dbus_unregister_object_per_iface(ctrl_iface,
|
|
|
|
wpa_s->dbus_groupobj_path);
|
|
|
|
|
|
|
|
os_free(wpa_s->dbus_groupobj_path);
|
|
|
|
wpa_s->dbus_groupobj_path = NULL;
|
|
|
|
}
|
|
|
|
|
2011-06-23 20:25:13 +02:00
|
|
|
static const struct wpa_dbus_property_desc
|
|
|
|
wpas_dbus_persistent_group_properties[] = {
|
|
|
|
{ "Properties", WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, "a{sv}",
|
|
|
|
wpas_dbus_getter_persistent_group_properties,
|
2015-10-13 18:47:46 +02:00
|
|
|
wpas_dbus_setter_persistent_group_properties,
|
|
|
|
NULL
|
2011-06-23 20:25:13 +02:00
|
|
|
},
|
2015-10-13 18:47:46 +02:00
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
2011-06-23 20:25:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* No signals intended for persistent group objects */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_register_persistent_group - Register a configured(saved)
|
|
|
|
* persistent group with dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @ssid: persistent group (still represented as a network within wpa)
|
|
|
|
* configuration data
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Registers a persistent group representing object with dbus.
|
|
|
|
*/
|
|
|
|
int wpas_dbus_register_persistent_group(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_ssid *ssid)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
struct wpa_dbus_object_desc *obj_desc;
|
|
|
|
struct network_handler_args *arg;
|
|
|
|
char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL)
|
|
|
|
return 0;
|
2015-04-29 12:13:34 +02:00
|
|
|
wpa_s = wpa_s->parent->parent;
|
|
|
|
if (!wpa_s->dbus_new_path)
|
|
|
|
return 0;
|
2011-06-23 20:25:13 +02:00
|
|
|
|
|
|
|
/* Make sure ssid is a persistent group */
|
|
|
|
if (ssid->disabled != 2 && !ssid->p2p_persistent_group)
|
|
|
|
return -1; /* should we return w/o complaining? */
|
|
|
|
|
2014-10-23 10:31:21 +02:00
|
|
|
if (wpa_s->p2p_mgmt)
|
|
|
|
wpa_s = wpa_s->parent;
|
|
|
|
|
2011-06-23 20:25:13 +02:00
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
|
|
|
if (ctrl_iface == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Intentionally not coming up with different numbering scheme
|
|
|
|
* for persistent groups.
|
|
|
|
*/
|
|
|
|
os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, ssid->id);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Register persistent group object '%s'",
|
|
|
|
pgrp_obj_path);
|
|
|
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
|
|
|
if (!obj_desc) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"dbus: Not enough memory to create object description");
|
2011-06-23 20:25:13 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reusing the same context structure as that for networks
|
|
|
|
* since these are represented using same data structure.
|
|
|
|
*/
|
|
|
|
/* allocate memory for handlers arguments */
|
|
|
|
arg = os_zalloc(sizeof(struct network_handler_args));
|
|
|
|
if (!arg) {
|
2014-12-31 22:21:10 +01:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"dbus: Not enough memory to create arguments for method");
|
2011-06-23 20:25:13 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
arg->wpa_s = wpa_s;
|
|
|
|
arg->ssid = ssid;
|
|
|
|
|
|
|
|
wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL,
|
|
|
|
wpas_dbus_persistent_group_properties,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (wpa_dbus_register_object_per_iface(ctrl_iface, pgrp_obj_path,
|
|
|
|
wpa_s->ifname, obj_desc))
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
wpas_dbus_signal_persistent_group_added(wpa_s, ssid->id);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
|
|
|
free_dbus_object_desc(obj_desc);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wpas_dbus_unregister_persistent_group - Unregister a persistent_group
|
|
|
|
* from dbus
|
|
|
|
* @wpa_s: wpa_supplicant interface structure
|
|
|
|
* @nid: network id
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Unregisters persistent group representing object from dbus
|
|
|
|
*
|
|
|
|
* NOTE: There is a slight issue with the semantics here. While the
|
|
|
|
* implementation simply means the persistent group is unloaded from memory,
|
|
|
|
* it should not get interpreted as the group is actually being erased/removed
|
|
|
|
* from persistent storage as well.
|
|
|
|
*/
|
|
|
|
int wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s,
|
|
|
|
int nid)
|
|
|
|
{
|
|
|
|
struct wpas_dbus_priv *ctrl_iface;
|
|
|
|
char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Do nothing if the control interface is not turned on */
|
2015-04-29 12:13:34 +02:00
|
|
|
if (wpa_s == NULL || wpa_s->global == NULL)
|
2011-06-23 20:25:13 +02:00
|
|
|
return 0;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2015-04-29 12:13:34 +02:00
|
|
|
wpa_s = wpa_s->parent->parent;
|
2014-10-23 10:31:21 +02:00
|
|
|
|
2011-06-23 20:25:13 +02:00
|
|
|
ctrl_iface = wpa_s->global->dbus;
|
2015-04-29 12:13:34 +02:00
|
|
|
if (ctrl_iface == NULL || !wpa_s->dbus_new_path)
|
2011-06-23 20:25:13 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
|
|
|
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
|
|
|
|
wpa_s->dbus_new_path, nid);
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "dbus: Unregister persistent group object '%s'",
|
|
|
|
pgrp_obj_path);
|
|
|
|
ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, pgrp_obj_path);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
wpas_dbus_signal_persistent_group_removed(wpa_s, nid);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-06-13 00:08:19 +02:00
|
|
|
#endif /* CONFIG_P2P */
|