aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dbus
diff options
context:
space:
mode:
authorNishant Chaprana <n.chaprana@samsung.com>2016-06-20 04:48:21 (GMT)
committerJouni Malinen <j@w1.fi>2016-06-24 16:02:58 (GMT)
commit82b9ec3125d628fdf1773b1d1184fbc1579dc3c8 (patch)
tree4db9c80121e5112022323275b48919815d435bbe /wpa_supplicant/dbus
parente18d1708486ce7d02c405ca31a5ac06c6d64e2d2 (diff)
downloadhostap-82b9ec3125d628fdf1773b1d1184fbc1579dc3c8.zip
hostap-82b9ec3125d628fdf1773b1d1184fbc1579dc3c8.tar.gz
hostap-82b9ec3125d628fdf1773b1d1184fbc1579dc3c8.tar.bz2
D-Bus: Add DeviceFoundProperties signal for discovered peers
This signal sends the peer properties to applications for discovered peers. The signature of this event is "oa{sv}". This event is needed because the current DeviceFound signal provides only the peer object path. If there are many peers in range there will be many DeviceFound signals and for each DeviceFound signal, applications would need to use GetAll to fetch peer properties. Doing this many times would create extra load over application as well as over wpa_supplicant, so it is better to send peer properties in the event so that applications can extract found peer information without extra steps. The existing DeviceFound signal is left as-is to avoid changing its signature. The issue is not applicable to the control interface because the P2P-DEVICE-FOUND event includes peer info in it, but over D-Bus interface DeviceFound provides only the peer object. Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
Diffstat (limited to 'wpa_supplicant/dbus')
-rw-r--r--wpa_supplicant/dbus/dbus_new.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 0263b2c..6d73bbc 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3352,6 +3352,13 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
END_ARGS
}
},
+ { "DeviceFoundProperties", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
+ {
+ { "path", "o", ARG_OUT },
+ { "properties", "a{sv}", ARG_OUT },
+ END_ARGS
+ }
+ },
{ "DeviceLost", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
{
{ "path", "o", ARG_OUT },
@@ -3800,12 +3807,13 @@ static const struct wpa_dbus_signal_desc wpas_dbus_p2p_peer_signals[] = {
* In case of peer objects, it would be emitted by either
* the "interface object" or by "peer objects"
* @sig_name: signal name - DeviceFound
+ * @properties: Whether to add a second argument with object properties
*
- * Notify listeners about event related with newly found p2p peer device
+ * Notify listeners about event related with p2p peer device
*/
static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
const u8 *dev_addr, const char *interface,
- const char *sig_name)
+ const char *sig_name, int properties)
{
struct wpas_dbus_priv *iface;
DBusMessage *msg;
@@ -3833,7 +3841,10 @@ static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
dbus_message_iter_init_append(msg, &iter);
path = peer_obj_path;
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &path))
+ &path) ||
+ (properties && !wpa_dbus_get_object_properties(
+ iface, peer_obj_path, WPAS_DBUS_NEW_IFACE_P2P_PEER,
+ &iter)))
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
else
dbus_connection_send(iface->con, msg, NULL);
@@ -3854,7 +3865,11 @@ void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
{
wpas_dbus_signal_peer(wpa_s, dev_addr,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "DeviceFound");
+ "DeviceFound", FALSE);
+
+ wpas_dbus_signal_peer(wpa_s, dev_addr,
+ WPAS_DBUS_NEW_IFACE_P2PDEVICE,
+ "DeviceFoundProperties", TRUE);
}
/**
@@ -3869,7 +3884,7 @@ void wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
{
wpas_dbus_signal_peer(wpa_s, dev_addr,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "DeviceLost");
+ "DeviceLost", FALSE);
}
/**