18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* 28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * WPA Supplicant / dbus-based control interface 38d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. 48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com> 58d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Copyright (c) 2009, Jouni Malinen <j@w1.fi> 68d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * This software may be distributed under the terms of the BSD license. 804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * See README for more details. 98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "includes.h" 128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "common.h" 1475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#include "common/ieee802_11_defs.h" 158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "wps/wps.h" 168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "../config.h" 178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "../wpa_supplicant_i.h" 188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "../bss.h" 191f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#include "../wpas_glue.h" 208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "dbus_new_helpers.h" 218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "dbus_dict_helpers.h" 228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "dbus_new.h" 238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "dbus_new_handlers.h" 248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "dbus_common_i.h" 2575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#include "dbus_new_handlers_p2p.h" 2675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#include "p2p/p2p.h" 27d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt#include "../p2p_supplicant.h" 288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_AP /* until needed by something else */ 3004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 3104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/* 3204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * NameOwnerChanged handling 3304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * 3404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Some services we provide allow an application to register for 3504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * a signal that it needs. While it can also unregister, we must 3604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * be prepared for the case where the application simply crashes 3704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * and thus doesn't clean up properly. The way to handle this in 3804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * DBus is to register for the NameOwnerChanged signal which will 3904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * signal an owner change to NULL if the peer closes the socket 4004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * for whatever reason. 4104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * 4204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Handle this signal via a filter function whenever necessary. 4304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * The code below also handles refcounting in case in the future 4404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * there will be multiple instances of this subscription scheme. 4504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */ 4604949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstatic const char wpas_dbus_noc_filter_str[] = 4704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt "interface=org.freedesktop.DBus,member=NameOwnerChanged"; 4804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 4904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 5004949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstatic DBusHandlerResult noc_filter(DBusConnection *conn, 5104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBusMessage *message, void *data) 5204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt{ 5304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt struct wpas_dbus_priv *priv = data; 5404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 5504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_SIGNAL) 5604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 5704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 5804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, 5904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt "NameOwnerChanged")) { 6004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const char *name; 6104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const char *prev_owner; 6204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const char *new_owner; 6304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBusError derr; 6404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt struct wpa_supplicant *wpa_s; 6504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 6604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_error_init(&derr); 6704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 6804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (!dbus_message_get_args(message, &derr, 6904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBUS_TYPE_STRING, &name, 7004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBUS_TYPE_STRING, &prev_owner, 7104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBUS_TYPE_STRING, &new_owner, 7204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBUS_TYPE_INVALID)) { 7304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /* Ignore this error */ 7404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_error_free(&derr); 7504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 7604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 7704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 78fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt for (wpa_s = priv->global->ifaces; wpa_s; wpa_s = wpa_s->next) { 7904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (wpa_s->preq_notify_peer != NULL && 8004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt os_strcmp(name, wpa_s->preq_notify_peer) == 0 && 8104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt (new_owner == NULL || os_strlen(new_owner) == 0)) { 8204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /* probe request owner disconnected */ 8304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt os_free(wpa_s->preq_notify_peer); 8404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_s->preq_notify_peer = NULL; 8504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_unsubscribe_noc(priv); 8604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 8704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 8804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 8904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 9004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 9104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt} 9204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 9304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 9404949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid wpas_dbus_subscribe_noc(struct wpas_dbus_priv *priv) 9504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt{ 9604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt priv->dbus_noc_refcnt++; 9704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (priv->dbus_noc_refcnt > 1) 9804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 9904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 10004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (!dbus_connection_add_filter(priv->con, noc_filter, priv, NULL)) { 10104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_printf(MSG_ERROR, "dbus: failed to add filter"); 10204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 10304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 10404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 10504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_bus_add_match(priv->con, wpas_dbus_noc_filter_str, NULL); 10604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt} 10704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 10804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 10904949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid wpas_dbus_unsubscribe_noc(struct wpas_dbus_priv *priv) 11004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt{ 11104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt priv->dbus_noc_refcnt--; 11204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (priv->dbus_noc_refcnt > 0) 11304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 11404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 11504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_bus_remove_match(priv->con, wpas_dbus_noc_filter_str, NULL); 11604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_connection_remove_filter(priv->con, noc_filter, priv); 11704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt} 11804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 11904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_AP */ 12004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_interface - Send a interface related event signal 1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sig_name: signal name - InterfaceAdded or InterfaceRemoved 1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @properties: Whether to add second argument with object properties 1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about event related with interface 1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_interface(struct wpa_supplicant *wpa_s, 1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *sig_name, int properties) 1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 1351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 140cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(WPAS_DBUS_NEW_PATH, 1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_INTERFACE, sig_name); 1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 150fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &wpa_s->dbus_new_path) || 151fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (properties && 152fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_get_object_properties( 153fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt iface, wpa_s->dbus_new_path, 154fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, &iter))) 155fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 156fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 157fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_interface_added - Send a interface created signal 1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about creating new interface 1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_interface_added(struct wpa_supplicant *wpa_s) 1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_interface(wpa_s, "InterfaceAdded", TRUE); 1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_interface_removed - Send a interface removed signal 1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 1788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about removing interface 1798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_interface_removed(struct wpa_supplicant *wpa_s) 1818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_interface(wpa_s, "InterfaceRemoved", FALSE); 1838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_scan_done - send scan done signal 1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @success: indicates if scanning succeed or failed 1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about finishing a scan 1938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success) 1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 1978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 1988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_bool_t succ; 1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 203cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 2078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 2088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "ScanDone"); 2098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt succ = success ? TRUE : FALSE; 2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &succ, 2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBUS_TYPE_INVALID)) 2158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 2168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 2178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 2188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 2198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 2208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 223fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt * wpas_dbus_signal_bss - Send a BSS related event signal 2248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 2258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bss_obj_path: BSS object path 2268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sig_name: signal name - BSSAdded or BSSRemoved 2278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @properties: Whether to add second argument with object properties 2288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about event related with BSS 2308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_bss(struct wpa_supplicant *wpa_s, 2328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *bss_obj_path, 2338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *sig_name, int properties) 2348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 2358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 2368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 2371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 2388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 2408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 242cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 2438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 2468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sig_name); 2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 253fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &bss_obj_path) || 254fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (properties && 255fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_get_object_properties(iface, bss_obj_path, 256fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt WPAS_DBUS_NEW_IFACE_BSS, 257fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &iter))) 258fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 259fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 260fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_bss_added - Send a BSS added signal 2678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 2688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bss_obj_path: new BSS object path 2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about adding new BSS 2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_bss_added(struct wpa_supplicant *wpa_s, 2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *bss_obj_path) 2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_bss(wpa_s, bss_obj_path, "BSSAdded", TRUE); 2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 2778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_bss_removed - Send a BSS removed signal 2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 2828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bss_obj_path: BSS object path 2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about removing BSS 2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_bss_removed(struct wpa_supplicant *wpa_s, 2878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *bss_obj_path) 2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_bss(wpa_s, bss_obj_path, "BSSRemoved", FALSE); 2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 2918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_blob - Send a blob related event signal 2958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 2968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @name: blob name 2978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sig_name: signal name - BlobAdded or BlobRemoved 2988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about event related with blob 3008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_blob(struct wpa_supplicant *wpa_s, 3028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *name, const char *sig_name) 3038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 310cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sig_name); 3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, 3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBUS_TYPE_INVALID)) 3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 3298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_blob_added - Send a blob added signal 3308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 3318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @name: blob name 3328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about adding a new blob 3348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s, 3368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *name) 3378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_blob(wpa_s, name, "BlobAdded"); 3398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 3408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 3438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_blob_removed - Send a blob removed signal 3448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 3458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @name: blob name 3468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about removing blob 3488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s, 3508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *name) 3518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_blob(wpa_s, name, "BlobRemoved"); 3538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 3548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 3578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network - Send a network related event signal 3588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 3598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: new network id 3608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sig_name: signal name - NetworkAdded, NetworkRemoved or NetworkSelected 3618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @properties: determines if add second argument with object properties 3628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about event related with configured network 3648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_network(struct wpa_supplicant *wpa_s, 3668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int id, const char *sig_name, 3678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int properties) 3688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 3708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 3711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 3728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 3738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 3758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 377cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 3788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 3798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 3818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", 3828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, id); 3838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 3858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 3868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sig_name); 3878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 3888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 3898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 3918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt path = net_obj_path; 3928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 393fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &path) || 394fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (properties && 395fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_get_object_properties( 396fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt iface, net_obj_path, WPAS_DBUS_NEW_IFACE_NETWORK, 397fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &iter))) 398fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 399fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 400fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 4018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 4028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 4038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 4068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network_added - Send a network added signal 4078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 4088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: new network id 4098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about adding new network 4118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_network_added(struct wpa_supplicant *wpa_s, 4138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int id) 4148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 4158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network(wpa_s, id, "NetworkAdded", TRUE); 4168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 4178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 4208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network_removed - Send a network removed signal 4218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 4228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: network id 4238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about removing a network 4258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_network_removed(struct wpa_supplicant *wpa_s, 4278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int id) 4288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 4298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network(wpa_s, id, "NetworkRemoved", FALSE); 4308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 4318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 4348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network_selected - Send a network selected signal 4358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 4368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: network id 4378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about selecting a network 4398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id) 4418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 4428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network(wpa_s, id, "NetworkSelected", FALSE); 4438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 4448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 4471f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * wpas_dbus_signal_network_request - Indicate that additional information 4481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * (EAP password, etc.) is required to complete the association to this SSID 4491f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 4501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @rtype: The specific additional information required 4511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @default_text: Optional description of required information 4521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 4531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Request additional information or passwords to complete an association 4541f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * request. 4551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 4561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtvoid wpas_dbus_signal_network_request(struct wpa_supplicant *wpa_s, 4571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt struct wpa_ssid *ssid, 4581f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt enum wpa_ctrl_req_type rtype, 4591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const char *default_txt) 4601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt{ 4611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt struct wpas_dbus_priv *iface; 4621f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessage *msg; 4631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 4641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 4651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const char *field, *txt = NULL, *net_ptr; 4661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt iface = wpa_s->global->dbus; 4681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Do nothing if the control interface is not turned on */ 470cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 4711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt return; 4721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt field = wpa_supplicant_ctrl_req_to_string(rtype, default_txt, &txt); 4741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (field == NULL) 4751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt return; 4761f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 4781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 4791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "NetworkRequest"); 4801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (msg == NULL) 4811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt return; 4821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 4841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", 4851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpa_s->dbus_new_path, ssid->id); 4861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt net_ptr = &net_obj_path[0]; 4871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_message_iter_init_append(msg, &iter); 4891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 490fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &net_ptr) || 491fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &field) || 492fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &txt)) 493fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 494fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 495fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 4961f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_message_unref(msg); 4971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt} 4981f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 5001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 5018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network_enabled_changed - Signals Enabled property changes 5028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 5038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: configured network which Enabled property has changed 5048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends PropertyChanged signals containing new value of Enabled property 5068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for specified network 5078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s, 5098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_ssid *ssid) 5108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 5118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char path[WPAS_DBUS_OBJECT_PATH_MAX]; 513fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 514cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 515cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 5168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX, 5178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d", 5188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, ssid->id); 5198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_dbus_mark_property_changed(wpa_s->global->dbus, path, 5218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_NETWORK, "Enabled"); 5228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 5238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS 5268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 5287a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt * wpas_dbus_signal_wps_event_pbc_overlap - Signals PBC overlap WPS event 5297a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 5307a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt * 5317a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt * Sends Event dbus signal with name "pbc-overlap" and empty dict as arguments 5327a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt */ 5337a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidtvoid wpas_dbus_signal_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s) 5347a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt{ 5357a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5367a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt DBusMessage *msg; 5377a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt DBusMessageIter iter, dict_iter; 5387a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt struct wpas_dbus_priv *iface; 5397a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt char *key = "pbc-overlap"; 5407a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5417a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt iface = wpa_s->global->dbus; 5427a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5437a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 5447a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 5457a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt return; 5467a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5477a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 5487a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, "Event"); 5497a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt if (msg == NULL) 5507a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt return; 5517a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5527a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 5537a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5547a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 5557a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt !wpa_dbus_dict_open_write(&iter, &dict_iter) || 5567a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 5577a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 5587a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt else 5597a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 5607a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5617a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt dbus_message_unref(msg); 5627a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt} 5637a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5647a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt 5657a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt/** 5668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_wps_event_success - Signals Success WPS event 5678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 5688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends Event dbus signal with name "success" and empty dict as arguments 5708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s) 5728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 5738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 5758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessageIter iter, dict_iter; 5768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 5778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *key = "success"; 5788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 5808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 582cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 5838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 5848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 5868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, "Event"); 5878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 5888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 5898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 5918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 5938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_open_write(&iter, &dict_iter) || 5948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 5958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 5968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 5978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 5988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 6008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 6018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 6048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_wps_event_fail - Signals Fail WPS event 6058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 606a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @fail: WPS failure information 6078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends Event dbus signal with name "fail" and dictionary containing 6098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * "msg field with fail message number (int32) as arguments 6108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s, 6128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_event_fail *fail) 6138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 6148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 6168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessageIter iter, dict_iter; 6178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 6188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *key = "fail"; 6198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 6218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 623cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 6248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 6258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 6278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, "Event"); 6288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 6298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 6308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 6328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 6348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_open_write(&iter, &dict_iter) || 6358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "msg", fail->msg) || 636d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "config_error", 637d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt fail->config_error) || 638d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "error_indication", 639d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt fail->error_indication) || 6408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 6418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 6428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 6438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 6448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 6468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 6478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 6508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_wps_event_m2d - Signals M2D WPS event 6518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 652a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @m2d: M2D event data information 6538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends Event dbus signal with name "m2d" and dictionary containing 6558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * fields of wps_event_m2d structure. 6568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s, 6588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_event_m2d *m2d) 6598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 6608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 6628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessageIter iter, dict_iter; 6638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 6648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *key = "m2d"; 6658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 6678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 669cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 6708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 6718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 6738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, "Event"); 6748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 6758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 6768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 6788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 6808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_open_write(&iter, &dict_iter) || 6818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_uint16(&dict_iter, "config_methods", 6828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->config_methods) || 6838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "manufacturer", 6848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) m2d->manufacturer, 6858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->manufacturer_len) || 6868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "model_name", 6878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) m2d->model_name, 6888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->model_name_len) || 6898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "model_number", 6908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) m2d->model_number, 6918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->model_number_len) || 6928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "serial_number", 6938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) 6948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->serial_number, 6958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->serial_number_len) || 6968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "dev_name", 6978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) m2d->dev_name, 6988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->dev_name_len) || 6998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "primary_dev_type", 7008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) 7018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->primary_dev_type, 8) || 7028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_uint16(&dict_iter, "config_error", 7038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->config_error) || 7048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_uint16(&dict_iter, "dev_password_id", 7058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->dev_password_id) || 7068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 7078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 7088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 7098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 7108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 7128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 7138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_wps_cred - Signals new credentials 7178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 718a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @cred: WPS Credential information 7198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends signal with credentials in directory argument 7218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s, 7238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wps_credential *cred) 7248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 7258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 7268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessageIter iter, dict_iter; 7278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 72821de214b4ba4271ca20843f3b8fba9f1501b2a89Dmitry Shmidt char *auth_type[5]; /* we have five possible authentication types */ 7298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int at_num = 0; 73021de214b4ba4271ca20843f3b8fba9f1501b2a89Dmitry Shmidt char *encr_type[3]; /* we have three possible encryption types */ 7318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int et_num = 0; 7328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 7348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 736cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 7378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 7388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 7408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, 7418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "Credentials"); 7428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 7438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 7448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 7468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 7478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto nomem; 7488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_OPEN) 7508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt auth_type[at_num++] = "open"; 7518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_WPAPSK) 7528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt auth_type[at_num++] = "wpa-psk"; 7538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_WPA) 7548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt auth_type[at_num++] = "wpa-eap"; 7558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_WPA2) 7568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt auth_type[at_num++] = "wpa2-eap"; 7578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_WPA2PSK) 75821de214b4ba4271ca20843f3b8fba9f1501b2a89Dmitry Shmidt auth_type[at_num++] = "wpa2-psk"; 7598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->encr_type & WPS_ENCR_NONE) 7618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt encr_type[et_num++] = "none"; 7628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->encr_type & WPS_ENCR_TKIP) 7638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt encr_type[et_num++] = "tkip"; 7648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->encr_type & WPS_ENCR_AES) 7658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt encr_type[et_num++] = "aes"; 7668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 767fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if ((wpa_s->current_ssid && 768fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_byte_array( 769fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &dict_iter, "BSSID", 770fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (const char *) wpa_s->current_ssid->bssid, ETH_ALEN)) || 771fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "SSID", 7728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) cred->ssid, 7738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt cred->ssid_len) || 7748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_string_array(&dict_iter, "AuthType", 7758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char **) auth_type, 7768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt at_num) || 7778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_string_array(&dict_iter, "EncrType", 7788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char **) encr_type, 7798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt et_num) || 7808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "Key", 7818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) cred->key, 7828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt cred->key_len) || 7838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_uint32(&dict_iter, "KeyIndex", 7848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt cred->key_idx) || 7858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 7868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto nomem; 7878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 7898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtnomem: 7918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 7928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 7938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */ 7958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 796c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidtvoid wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s, 797c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt int depth, const char *subject, 798432d603c922e970f55866c63212d29c997438977Dmitry Shmidt const char *altsubject[], 799432d603c922e970f55866c63212d29c997438977Dmitry Shmidt int num_altsubject, 800c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt const char *cert_hash, 801c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt const struct wpabuf *cert) 802c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt{ 803c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt struct wpas_dbus_priv *iface; 804c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt DBusMessage *msg; 805c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt DBusMessageIter iter, dict_iter; 806c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 807c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt iface = wpa_s->global->dbus; 808c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 809c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt /* Do nothing if the control interface is not turned on */ 810cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 811c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt return; 812c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 813c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 814c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 815c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt "Certification"); 816c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt if (msg == NULL) 817c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt return; 818c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 819c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt dbus_message_iter_init_append(msg, &iter); 820fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || 821fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_uint32(&dict_iter, "depth", depth) || 822fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "subject", subject) || 823432d603c922e970f55866c63212d29c997438977Dmitry Shmidt (altsubject && num_altsubject && 824432d603c922e970f55866c63212d29c997438977Dmitry Shmidt !wpa_dbus_dict_append_string_array(&dict_iter, "altsubject", 825432d603c922e970f55866c63212d29c997438977Dmitry Shmidt altsubject, num_altsubject)) || 826fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (cert_hash && 827fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "cert_hash", 828fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt cert_hash)) || 829fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (cert && 830fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "cert", 831fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpabuf_head(cert), 832fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpabuf_len(cert))) || 833fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 834fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 835fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 836fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 837c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt dbus_message_unref(msg); 838c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt} 839c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 84004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 84104949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s, 84204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const char *status, const char *parameter) 84304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt{ 84404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt struct wpas_dbus_priv *iface; 84504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBusMessage *msg; 84604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBusMessageIter iter; 84704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 84804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt iface = wpa_s->global->dbus; 84904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 85004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /* Do nothing if the control interface is not turned on */ 851cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 85204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 85304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 85404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 85504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 85604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt "EAP"); 85704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (msg == NULL) 85804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 85904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 86004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_message_iter_init_append(msg, &iter); 86104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 862fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &status) || 86304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt !dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, 86404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt ¶meter)) 865fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 866fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 867fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 86804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_message_unref(msg); 86904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt} 87004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 87104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 87234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt/** 87334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * wpas_dbus_signal_sta - Send a station related event signal 87434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 87534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @sta: station mac address 87634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @sig_name: signal name - StaAuthorized or StaDeauthorized 87734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * 87834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * Notify listeners about event related with station 87934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt */ 88034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidtstatic void wpas_dbus_signal_sta(struct wpa_supplicant *wpa_s, 88134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt const u8 *sta, const char *sig_name) 88234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt{ 88334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt struct wpas_dbus_priv *iface; 88434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt DBusMessage *msg; 88534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt char sta_mac[WPAS_DBUS_OBJECT_PATH_MAX]; 88634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt char *dev_mac; 88734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 88834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt os_snprintf(sta_mac, WPAS_DBUS_OBJECT_PATH_MAX, MACSTR, MAC2STR(sta)); 88934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt dev_mac = sta_mac; 89034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 89134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt iface = wpa_s->global->dbus; 89234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 89334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 894cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 89534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt return; 89634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 89734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 89834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, sig_name); 89934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt if (msg == NULL) 90034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt return; 90134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 90234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &dev_mac, 90334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt DBUS_TYPE_INVALID)) 90434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 90534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt else 90634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 90734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt dbus_message_unref(msg); 90834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 90934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Station MAC address '%s' '%s'", 91034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt sta_mac, sig_name); 91134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt} 91234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 91334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 91434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt/** 91534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * wpas_dbus_signal_sta_authorized - Send a STA authorized signal 91634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 91734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @sta: station mac address 91834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * 91934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * Notify listeners a new station has been authorized 92034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt */ 92134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidtvoid wpas_dbus_signal_sta_authorized(struct wpa_supplicant *wpa_s, 92234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt const u8 *sta) 92334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt{ 92434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt wpas_dbus_signal_sta(wpa_s, sta, "StaAuthorized"); 92534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt} 92634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 92734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 92834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt/** 92934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * wpas_dbus_signal_sta_deauthorized - Send a STA deauthorized signal 93034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 93134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @sta: station mac address 93234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * 93334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * Notify listeners a station has been deauthorized 93434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt */ 93534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidtvoid wpas_dbus_signal_sta_deauthorized(struct wpa_supplicant *wpa_s, 93634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt const u8 *sta) 93734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt{ 93834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt wpas_dbus_signal_sta(wpa_s, sta, "StaDeauthorized"); 93934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt} 94034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 94134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 94275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 9438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 94575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_p2p_group_removed - Signals P2P group was removed 9468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 94775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @role: role of this device (client or GO) 94875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends signal with i/f name and role as string arguments 9498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 95075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s, 95175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const char *role) 9528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 95375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 95403658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt DBusMessageIter iter, dict_iter; 95575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface = wpa_s->global->dbus; 956fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt struct wpa_supplicant *parent; 9578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 95875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 95975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 9608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 96175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 962fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent = wpa_s->parent; 963fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (parent->p2p_mgmt) 964fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent = parent->parent; 965fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 966cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_groupobj_path || !wpa_s->dbus_new_path || 967cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt !parent->dbus_new_path) 96803658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt return; 96903658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt 970fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt msg = dbus_message_new_signal(parent->dbus_new_path, 97175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 97275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "GroupFinished"); 97375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 97475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 97575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 97675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 977fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || 978fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_object_path(&dict_iter, 97903658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt "interface_object", 980fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s->dbus_new_path) || 981fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "role", role) || 982fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_object_path(&dict_iter, "group_object", 98303658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt wpa_s->dbus_groupobj_path) || 98403658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 985fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 986fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 987fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 98875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 9898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 9908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 99375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_p2p_provision_discovery - Signals various PD events 9948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 99575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev_addr - who sent the request or responded to our request. 99675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @request - Will be 1 if request, 0 for response. 99775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @status - valid only in case of response 99875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @config_methods - wps config methods 99975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @generated_pin - pin to be displayed in case of WPS_CONFIG_DISPLAY method 100075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 100175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends following provision discovery related events: 100275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryRequestDisplayPin 100375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryResponseDisplayPin 100475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryRequestEnterPin 100575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryResponseEnterPin 100675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryPBCRequest 100775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryPBCResponse 100875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 100975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * TODO:: 101075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryFailure (timeout case) 10118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 101275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s, 101375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr, int request, 101475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen enum p2p_prov_disc_status status, 101575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen u16 config_methods, 101675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen unsigned int generated_pin) 10178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 101875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 101975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 102075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 102175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *_signal; 102275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int add_pin = 0; 102375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 102475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int error_ret = 1; 102575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char pin[9], *p_pin = NULL; 10268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 102775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 102875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 102975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 103075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 10318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 103275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1033fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 1034fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 1035cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 1036cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 1037fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 103875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (request || !status) { 103975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (config_methods & WPS_CONFIG_DISPLAY) 104075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen _signal = request ? 104175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryRequestDisplayPin" : 104275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryResponseEnterPin"; 104375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else if (config_methods & WPS_CONFIG_KEYPAD) 104475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen _signal = request ? 104575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryRequestEnterPin" : 104675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryResponseDisplayPin"; 104775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else if (config_methods & WPS_CONFIG_PUSHBUTTON) 104875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen _signal = request ? "ProvisionDiscoveryPBCRequest" : 104975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryPBCResponse"; 105075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 105175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; /* Unknown or un-supported method */ 1052fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } else { 105375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Explicit check for failure response */ 105475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen _signal = "ProvisionDiscoveryFailure"; 1055fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } 105675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 105775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen add_pin = ((request && (config_methods & WPS_CONFIG_DISPLAY)) || 105875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (!request && !status && 105975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (config_methods & WPS_CONFIG_KEYPAD))); 106075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 106175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (add_pin) { 106275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(pin, sizeof(pin), "%08d", generated_pin); 106375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen p_pin = pin; 10648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 10658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 106675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 106775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, _signal); 106875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 106975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 10708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 107175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Check if this is a known peer */ 10721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!p2p_peer_known(wpa_s->global->p2p, dev_addr)) 107375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 107475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 107575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 107675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 107775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, 107875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(dev_addr)); 107975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 108075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 108175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 108275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 108375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 108475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, 108575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBUS_TYPE_OBJECT_PATH, 108675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &path)) 108775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 108875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 108975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!request && status) 109075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Attach status to ProvisionDiscoveryFailure */ 109175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen error_ret = !dbus_message_iter_append_basic(&iter, 109275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBUS_TYPE_INT32, 109375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &status); 109475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 109575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen error_ret = (add_pin && 109675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !dbus_message_iter_append_basic(&iter, 109775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBUS_TYPE_STRING, 109875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &p_pin)); 109975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 110075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerror: 110175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!error_ret) 110275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 110375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 110475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 110575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 110675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 11078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 11088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1110a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt/** 1111a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * wpas_dbus_signal_p2p_go_neg_req - Signal P2P GO Negotiation Request RX 1112a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1113a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @src: Source address of the message triggering this notification 1114a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @dev_passwd_id: WPS Device Password Id 1115a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @go_intent: Peer's GO Intent value 1116a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * 1117a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * Sends signal to notify that a peer P2P Device is requesting group owner 1118a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * negotiation with us. 1119a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt */ 112075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s, 11217a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt const u8 *src, u16 dev_passwd_id, 11227a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt u8 go_intent) 11238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 112475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 112575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 112675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 112775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 112875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 112975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 113075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 113175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 113275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 113375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 113475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1135fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 1136fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 1137cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 1138cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 1139fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 114075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 114175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 114275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(src)); 114375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 114475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 114575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 114675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 114775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "GONegotiationRequest"); 114875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 114975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 115075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 115175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 115275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 115375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 115475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &path) || 115575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT16, 11567a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt &dev_passwd_id) || 11577a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt !dbus_message_iter_append_basic(&iter, DBUS_TYPE_BYTE, 11587a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt &go_intent)) 115975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 116075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 116175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 116275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 116375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 116475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 116575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 116675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 116775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic int wpas_dbus_get_group_obj_path(struct wpa_supplicant *wpa_s, 116875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_ssid *ssid, 116975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *group_obj_path) 117075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 117175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char group_name[3]; 117275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1173cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path || 1174cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt os_memcmp(ssid->ssid, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)) 117575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 117675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 117704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt os_memcpy(group_name, ssid->ssid + P2P_WILDCARD_SSID_LEN, 2); 117875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen group_name[2] = '\0'; 117975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 118075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(group_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 118175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_GROUPS_PART "/%s", 118275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, group_name); 118375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 118475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 11858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 11868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1188d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtstruct group_changed_data { 1189d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct wpa_supplicant *wpa_s; 1190d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct p2p_peer_info *info; 1191d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt}; 1192d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1193d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1194d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtstatic int match_group_where_peer_is_client(struct p2p_group *group, 1195d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void *user_data) 1196d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt{ 1197d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct group_changed_data *data = user_data; 1198d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt const struct p2p_group_config *cfg; 1199d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct wpa_supplicant *wpa_s_go; 1200d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1201d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt if (!p2p_group_is_client_connected(group, data->info->p2p_device_addr)) 1202d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt return 1; 1203d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1204d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt cfg = p2p_group_get_config(group); 1205d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1206d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_s_go = wpas_get_p2p_go_iface(data->wpa_s, cfg->ssid, 1207d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt cfg->ssid_len); 1208d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt if (wpa_s_go != NULL && wpa_s_go == data->wpa_s) { 1209d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpas_dbus_signal_peer_groups_changed( 12109c17526f86859e2b6aebac0ed4f2561601816103Dmitry Shmidt data->wpa_s->p2pdev, data->info->p2p_device_addr); 1211d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt return 0; 1212d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt } 1213d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1214d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt return 1; 1215d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt} 1216d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1217d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1218d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtstatic void signal_peer_groups_changed(struct p2p_peer_info *info, 1219d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void *user_data) 1220d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt{ 1221d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct group_changed_data *data = user_data; 1222d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct wpa_supplicant *wpa_s_go; 1223d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1224d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_s_go = wpas_get_p2p_client_iface(data->wpa_s, 1225d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt info->p2p_device_addr); 1226d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt if (wpa_s_go != NULL && wpa_s_go == data->wpa_s) { 12279c17526f86859e2b6aebac0ed4f2561601816103Dmitry Shmidt wpas_dbus_signal_peer_groups_changed(data->wpa_s->p2pdev, 1228d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt info->p2p_device_addr); 1229d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt return; 1230d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt } 1231d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1232d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt data->info = info; 1233d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt p2p_loop_on_all_groups(data->wpa_s->global->p2p, 1234d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt match_group_where_peer_is_client, data); 1235d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt data->info = NULL; 1236d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt} 1237d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1238d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1239d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtstatic void peer_groups_changed(struct wpa_supplicant *wpa_s) 1240d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt{ 1241d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct group_changed_data data; 1242d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1243d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt os_memset(&data, 0, sizeof(data)); 1244d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt data.wpa_s = wpa_s; 1245d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1246d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt p2p_loop_on_known_peers(wpa_s->global->p2p, 1247d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt signal_peer_groups_changed, &data); 1248d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt} 1249d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1250d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 12518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 125275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_p2p_group_started - Signals P2P group has 12531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * started. Emitted when a group is successfully started 125475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * irrespective of the role (client/GO) of the current device 12558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 125675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 125775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @client: this device is P2P client 1258d5ab1b53af720d05586ccc0addabe93459f1f388Dmitry Shmidt * @persistent: 0 - non persistent group, 1 - persistent group 1259abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt * @ip: When group role is client, it contains local IP address, netmask, and 1260abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt * GO's IP address, if assigned; otherwise, NULL 12618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 126275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s, 1263abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt int client, int persistent, 1264abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt const u8 *ip) 12658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 126675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 126775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 126875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 1269fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt struct wpa_supplicant *parent; 127075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1271fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent = wpa_s->parent; 1272fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (parent->p2p_mgmt) 1273fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent = parent->parent; 1274fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 1275fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt iface = parent->global->dbus; 127675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 127775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 1278cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !parent->dbus_new_path || !wpa_s->dbus_new_path) 127975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 128075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 128150b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt if (wpa_s->dbus_groupobj_path == NULL) 128275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 128375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 128475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* New interface has been created for this group */ 1285fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt msg = dbus_message_new_signal(parent->dbus_new_path, 128675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 128775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "GroupStarted"); 128875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 128975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 129075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 129175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 129275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* 129375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * In case the device supports creating a separate interface the 129475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * DBus client will need to know the object path for the interface 129575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * object this group was created on, so include it here. 129675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 1297fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || 1298fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_object_path(&dict_iter, 1299fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "interface_object", 1300fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s->dbus_new_path) || 1301fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "role", 1302fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt client ? "client" : "GO") || 1303d5ab1b53af720d05586ccc0addabe93459f1f388Dmitry Shmidt !wpa_dbus_dict_append_bool(&dict_iter, "persistent", persistent) || 1304fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_object_path(&dict_iter, "group_object", 130550b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt wpa_s->dbus_groupobj_path) || 1306abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt (ip && 1307abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt (!wpa_dbus_dict_append_byte_array(&dict_iter, "IpAddr", 1308abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt (char *) ip, 4) || 1309abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "IpAddrMask", 1310abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt (char *) ip + 4, 4) || 1311abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "IpAddrGo", 1312abb90a3fc1917e628167827cb14e742000605332Dmitry Shmidt (char *) ip + 8, 4))) || 1313fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) { 1314fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 1315fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } else { 1316fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 1317fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (client) 1318fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt peer_groups_changed(wpa_s); 1319fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } 132075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 13218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 13228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1325a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * wpas_dbus_signal_p2p_go_neg_resp - Emit GONegotiation Success/Failure signal 1326a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1327a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @res: Result of the GO Neg Request 13288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13291f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtvoid wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s, 13301f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt struct p2p_go_neg_results *res) 13318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 133275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 13331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter, dict_iter; 13341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter_dict_entry, iter_dict_val, iter_dict_array; 133575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 13361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 13371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_int32_t freqs[P2P_MAX_CHANNELS]; 13381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_int32_t *f_array = freqs; 13391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 134175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 13428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1343fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 1344fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 1345fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 13461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt os_memset(freqs, 0, sizeof(freqs)); 134775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 1348cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 134975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 13508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 13521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 13531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpa_s->dbus_new_path, MAC2STR(res->peer_device_addr)); 13541f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt path = peer_obj_path; 13551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 135675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 135775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 13581f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->status ? "GONegotiationFailure" : 13591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "GONegotiationSuccess"); 136075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 136175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 13628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_message_iter_init_append(msg, &iter); 1364fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || 1365fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_object_path(&dict_iter, "peer_object", 13661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt path) || 13671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "status", res->status)) 13681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 13691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13701f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!res->status) { 13711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt int i = 0; 13721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt int freq_list_num = 0; 13731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 1374fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if ((res->role_go && 1375fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "passphrase", 1376fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt res->passphrase)) || 1377fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "role_go", 13781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->role_go ? "GO" : 13791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "client") || 13801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "frequency", 13811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->freq) || 13821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "ssid", 13831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt (const char *) res->ssid, 13841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->ssid_len) || 13851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, 13861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "peer_device_addr", 13871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt (const char *) 13881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->peer_device_addr, 13891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt ETH_ALEN) || 13901f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, 13911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "peer_interface_addr", 13921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt (const char *) 13931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->peer_interface_addr, 13941f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt ETH_ALEN) || 13951f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "wps_method", 13961f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt p2p_wps_method_text( 13971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->wps_method))) 139875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 13991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 14001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt for (i = 0; i < P2P_MAX_CHANNELS; i++) { 14011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (res->freq_list[i]) { 14021f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt freqs[i] = res->freq_list[i]; 14031f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt freq_list_num++; 14041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt } 140575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 14061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 14071f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_begin_array(&dict_iter, 14081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "frequency_list", 14091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBUS_TYPE_INT32_AS_STRING, 14101f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_entry, 14111f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_val, 1412fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &iter_dict_array) || 1413fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !dbus_message_iter_append_fixed_array(&iter_dict_array, 14141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBUS_TYPE_INT32, 14151f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &f_array, 1416fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt freq_list_num) || 1417fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_end_array(&dict_iter, 14181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_entry, 14191f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_val, 1420fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &iter_dict_array) || 1421fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "persistent_group", 14221f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->persistent_group) || 14231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_uint32(&dict_iter, 14241f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "peer_config_timeout", 14251f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->peer_config_timeout)) 14261f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 142775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 14288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14291f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) 14301f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 14311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 143275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 143375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 143475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 14358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 14368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 143875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 14394171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * wpas_dbus_signal_p2p_invitation_result - Emit InvitationResult signal 14404171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 14414171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @status: Status of invitation process 14424171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @bssid: Basic Service Set Identifier 144375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 144475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s, 144575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int status, const u8 *bssid) 144675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 144775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 144875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 144975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 145075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1451051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidt wpa_printf(MSG_DEBUG, "%s", __func__); 145275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 145375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 145475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 145575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 145675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 145775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1458fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 1459fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 1460cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 1461cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 1462fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 146375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 146475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 146575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "InvitationResult"); 146675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 146775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 146875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 146975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 147075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 1471fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || 1472fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "status", status) || 1473fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (bssid && 1474fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "BSSID", 1475fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (const char *) bssid, 1476fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt ETH_ALEN)) || 1477fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 1478fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 1479fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 1480fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 148175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 148275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 148375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 148475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 148575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 148675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 148775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit a signal for a peer joining the group. 148875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * The signal will carry path to the group member object 148975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * constructed using p2p i/f addr used for connecting. 149075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 149175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 1492d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * @peer_addr: P2P Device Address of the peer joining the group 149375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 149475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s, 1495d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt const u8 *peer_addr) 149675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 149775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 149875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 149975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 1500d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 1501fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt struct wpa_supplicant *parent; 150275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 150375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 150475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 150575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 150675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 150775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 150875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 150975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_s->dbus_groupobj_path) 151075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 151175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1512fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent = wpa_s->parent; 1513fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (parent->p2p_mgmt) 1514fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent = parent->parent; 1515cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!parent->dbus_new_path) 1516cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 1517fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 1518d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 1519d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 152075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, 1521fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent->dbus_new_path, MAC2STR(peer_addr)); 152275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 152375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path, 152475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2P_GROUP, 152575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "PeerJoined"); 152675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 152775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 152875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 152975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 1530d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt path = peer_obj_path; 153175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 1532fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &path)) { 1533fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 1534fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } else { 1535fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 1536fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpas_dbus_signal_peer_groups_changed(parent, peer_addr); 1537fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } 153875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 153975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 154075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 154175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 154275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 154375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 154475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit a signal for a peer disconnecting the group. 154575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * The signal will carry path to the group member object 1546d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * constructed using the P2P Device Address of the peer. 154775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 154875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 1549d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * @peer_addr: P2P Device Address of the peer joining the group 155075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 155175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s, 1552d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt const u8 *peer_addr) 155375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 155475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 155575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 155675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 1557d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 1558fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt struct wpa_supplicant *parent; 155975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 156075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 156175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 156275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 156375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 156475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 156575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 156675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_s->dbus_groupobj_path) 156775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 156875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1569fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent = wpa_s->parent; 1570fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (parent->p2p_mgmt) 1571fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent = parent->parent; 1572cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!parent->dbus_new_path) 1573cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 1574fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 1575d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 1576d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 157775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, 1578fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt parent->dbus_new_path, MAC2STR(peer_addr)); 157975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 158075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path, 158175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2P_GROUP, 158275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "PeerDisconnected"); 158375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 158475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 158575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 158675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 1587d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt path = peer_obj_path; 158875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 1589fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &path)) { 1590fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 1591fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "dbus: Failed to construct PeerDisconnected signal"); 1592fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } else { 1593fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 1594fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpas_dbus_signal_peer_groups_changed(parent, peer_addr); 1595fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } 159675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 159775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 159875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 159975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 160075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 160175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 160275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit a signal for a service discovery request. 160375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * The signal will carry station address, frequency, dialog token, 160475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * update indicator and it tlvs 160575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 160675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 160775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @sa: station addr (p2p i/f) of the peer 160875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dialog_token: service discovery request dialog token 160975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @update_indic: service discovery request update indicator 161075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @tlvs: service discovery request genrated byte array of tlvs 161175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @tlvs_len: service discovery request tlvs length 161275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 161375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s, 161475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int freq, const u8 *sa, u8 dialog_token, 161575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen u16 update_indic, const u8 *tlvs, 161675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen size_t tlvs_len) 161775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 161875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 161975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 162075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 162175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 1622fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 162375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 162475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 162575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 162675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 162775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 162875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1629fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 1630fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 1631cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 1632cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 1633fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 1634fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt /* Check if this is a known peer */ 1635fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!p2p_peer_known(wpa_s->global->p2p, sa)) 1636fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt return; 1637fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 163875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 163975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 164075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ServiceDiscoveryRequest"); 164175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 164275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 164375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 164475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 164575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 164675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, wpa_s->dbus_new_path, MAC2STR(sa)); 164775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 164875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 164975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 165075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 1651fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || 1652fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_object_path(&dict_iter, "peer_object", 165375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path) || 165475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_int32(&dict_iter, "frequency", freq) || 165575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_int32(&dict_iter, "dialog_token", 165675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dialog_token) || 165775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator", 165875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen update_indic) || 165975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_byte_array(&dict_iter, "tlvs", 166075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (const char *) tlvs, 166175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen tlvs_len) || 166275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_close_write(&iter, &dict_iter)) 1663fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 1664fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 1665fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 166675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 166775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 166875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 166975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 167075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 167175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 167275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit a signal for a service discovery response. 167375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * The signal will carry station address, update indicator and it 167475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * tlvs 167575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 167675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 167775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @sa: station addr (p2p i/f) of the peer 167875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @update_indic: service discovery request update indicator 167975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @tlvs: service discovery request genrated byte array of tlvs 168075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @tlvs_len: service discovery request tlvs length 168175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 168275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s, 168375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *sa, u16 update_indic, 168475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *tlvs, size_t tlvs_len) 168575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 168675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 168775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 168875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 168975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 1690fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 169175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 169275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 169375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 169475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 169575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 169675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1697fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 1698fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 1699cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 1700cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 1701fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 1702fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt /* Check if this is a known peer */ 1703fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!p2p_peer_known(wpa_s->global->p2p, sa)) 1704fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt return; 1705fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 170675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 170775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 1708fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "ServiceDiscoveryResponse"); 170975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 171075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 171175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 171275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 171375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 171475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, wpa_s->dbus_new_path, MAC2STR(sa)); 171575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 171675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 171775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 171875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 1719fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || 1720fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_dict_append_object_path(&dict_iter, "peer_object", 172175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path) || 172275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator", 172375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen update_indic) || 172475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_byte_array(&dict_iter, "tlvs", 172575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (const char *) tlvs, 172675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen tlvs_len) || 172775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_close_write(&iter, &dict_iter)) 1728fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 1729fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 1730fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 173175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 173275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 173375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1734fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 173575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 173675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_persistent_group - Send a persistent group related 173775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * event signal 173875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 173975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @id: new persistent group id 174075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @sig_name: signal name - PersistentGroupAdded, PersistentGroupRemoved 174175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @properties: determines if add second argument with object properties 174275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 174375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about an event related to persistent groups. 174475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 174575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_signal_persistent_group(struct wpa_supplicant *wpa_s, 174675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int id, const char *sig_name, 174775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int properties) 174875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 174975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 175075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 17511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 175275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 175375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 175475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 175575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 175675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 175775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 175875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 175975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1760fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 1761fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 1762cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 1763cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 1764fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 176575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 176675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u", 176775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, id); 176875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 176975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 177075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 177175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen sig_name); 177275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 177375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 177475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 177575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 177675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = pgrp_obj_path; 177775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 1778fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt &path) || 1779fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (properties && 1780fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt !wpa_dbus_get_object_properties( 1781fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt iface, pgrp_obj_path, 1782fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, &iter))) 1783fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 1784fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 1785fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 178675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 178775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 178875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 178975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 179075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 179175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 179275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_persistent_group_added - Send a persistent_group 179375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * added signal 179475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 179575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @id: new persistent group id 179675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 179775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about addition of a new persistent group. 179875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 179975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_signal_persistent_group_added( 180075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_supplicant *wpa_s, int id) 180175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 180275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_persistent_group(wpa_s, id, "PersistentGroupAdded", 180375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen TRUE); 180475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 180575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 180675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 180775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 180875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_persistent_group_removed - Send a persistent_group 180975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * removed signal 181075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 181175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @id: persistent group id 181275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 181375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about removal of a persistent group. 181475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 181575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_signal_persistent_group_removed( 181675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_supplicant *wpa_s, int id) 181775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 181875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_persistent_group(wpa_s, id, "PersistentGroupRemoved", 181975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen FALSE); 182075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 182175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 182275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 182375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 182475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_p2p_wps_failed - Signals WpsFailed event 182575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 1826a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @fail: WPS failure information 182775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 182875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends Event dbus signal with name "fail" and dictionary containing 182975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * "msg" field with fail message number (int32) as arguments 183075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 183175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s, 183275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wps_event_fail *fail) 183375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 183475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 183575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 183675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 183775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 183875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *key = "fail"; 183975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 184075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 184175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 184275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 184375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 184475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 184575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1846fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 1847fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 1848fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 1849cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 1850cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 185175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 185275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 185375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "WpsFailed"); 185475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 185575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 185675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 185775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 185875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 185975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 186075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_open_write(&iter, &dict_iter) || 186175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_int32(&dict_iter, "msg", fail->msg) || 186275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_int16(&dict_iter, "config_error", 186375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen fail->config_error) || 186475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_close_write(&iter, &dict_iter)) 186575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 186675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 186775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 186875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 186975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 187075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 187175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1872d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1873d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt/** 1874d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * wpas_dbus_signal_p2p_group_formation_failure - Signals GroupFormationFailure event 1875d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1876d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @reason: indicates the reason code for group formation failure 1877d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * 1878d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * Sends Event dbus signal and string reason code when available. 1879d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt */ 1880d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtvoid wpas_dbus_signal_p2p_group_formation_failure(struct wpa_supplicant *wpa_s, 1881d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt const char *reason) 1882d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt{ 1883d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt DBusMessage *msg; 1884d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt struct wpas_dbus_priv *iface; 1885d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1886d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt iface = wpa_s->global->dbus; 1887d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1888d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 1889d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (iface == NULL) 1890d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return; 1891d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1892d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 1893d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt WPAS_DBUS_NEW_IFACE_P2PDEVICE, 1894d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt "GroupFormationFailure"); 1895d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (msg == NULL) 1896d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return; 1897d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1898d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &reason, 1899d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt DBUS_TYPE_INVALID)) 1900d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 1901d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt else 1902d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 1903d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1904d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt dbus_message_unref(msg); 1905d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt} 1906d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1907d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1908d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt/** 1909d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * wpas_dbus_signal_p2p_invitation_received - Emit InvitationReceived signal 1910d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1911d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @sa: Source address of the Invitation Request 1912d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @dev_add: GO Device Address 1913d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @bssid: P2P Group BSSID or %NULL if not received 1914d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @id: Persistent group id or %0 if not persistent group 1915d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @op_freq: Operating frequency for the group 1916d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt */ 1917d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1918d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtvoid wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant *wpa_s, 1919d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt const u8 *sa, const u8 *dev_addr, 1920d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt const u8 *bssid, int id, 1921d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt int op_freq) 1922d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt{ 1923d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt DBusMessage *msg; 1924d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt DBusMessageIter iter, dict_iter; 1925d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt struct wpas_dbus_priv *iface; 1926d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1927d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt iface = wpa_s->global->dbus; 1928d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1929d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 1930d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (iface == NULL) 1931d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return; 1932d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1933d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 1934d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt WPAS_DBUS_NEW_IFACE_P2PDEVICE, 1935d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt "InvitationReceived"); 1936d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (msg == NULL) 1937d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return; 1938d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1939d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 1940d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || 1941d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt (sa && 1942d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "sa", 1943d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt (const char *) sa, ETH_ALEN)) || 1944d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt (dev_addr && 1945d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "go_dev_addr", 1946d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt (const char *) dev_addr, 1947d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt ETH_ALEN)) || 1948d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt (bssid && 1949d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "bssid", 1950d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt (const char *) bssid, 1951d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt ETH_ALEN)) || 1952d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt (id && 1953d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "persistent_id", id)) || 1954d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "op_freq", op_freq) || 1955d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) { 1956d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt dbus_message_unref(msg); 1957d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return; 1958d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 1959d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1960d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 1961d7ff03d48f825360eec2a371e3361306f2fd721bDmitry Shmidt dbus_message_unref(msg); 1962d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt} 1963d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1964d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 1965fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt#endif /* CONFIG_P2P */ 196675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 196775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 196875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 196975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_prop_changed - Signals change of property 197075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 197175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @property: indicates which property has changed 197275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 197375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals with path, interface and arguments 197475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * depending on which property has changed. 197575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 197675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s, 197775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen enum wpas_dbus_prop property) 197875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 197975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *prop; 198004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_bool_t flush; 198175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 198275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_new_path == NULL) 198375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; /* Skip signal since D-Bus setup is not yet ready */ 198475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 198504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt flush = FALSE; 198675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen switch (property) { 198775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_AP_SCAN: 198875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "ApScan"; 198975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 1990092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart#ifdef CONFIG_IEEE80211W 1991092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart case WPAS_DBUS_PROP_PMF: 1992092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart prop = "Pmf"; 1993092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart break; 1994092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart#endif /* CONFIG_IEEE80211W */ 199575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_SCANNING: 199675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Scanning"; 199775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 199875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_STATE: 199975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "State"; 200075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 200175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_CURRENT_BSS: 200275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "CurrentBSS"; 200375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 200475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_CURRENT_NETWORK: 200575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "CurrentNetwork"; 200675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 200775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_BSSS: 200875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "BSSs"; 200975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 201075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_CURRENT_AUTH_MODE: 201175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "CurrentAuthMode"; 201275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 201304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt case WPAS_DBUS_PROP_DISCONNECT_REASON: 201404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt prop = "DisconnectReason"; 201504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt flush = TRUE; 201604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt break; 201731a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt case WPAS_DBUS_PROP_ASSOC_STATUS_CODE: 201831a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt prop = "AssocStatusCode"; 201931a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt flush = TRUE; 202031a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt break; 202175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen default: 202275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d", 202375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__, property); 202475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 202575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 202675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 202775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(wpa_s->global->dbus, 202875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, 202975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_INTERFACE, prop); 203004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (flush) { 203104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_dbus_flush_object_changed_properties( 203204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_s->global->dbus->con, wpa_s->dbus_new_path); 203304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 203475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 203575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 203675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 203775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 203875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_bss_signal_prop_changed - Signals change of BSS property 203975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 204075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @property: indicates which property has changed 204175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @id: unique BSS identifier 204275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 204375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals with path, interface, and arguments depending 204475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * on which property has changed. 204575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 204675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s, 204775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen enum wpas_dbus_bss_prop property, 204875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen unsigned int id) 204975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 205075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char path[WPAS_DBUS_OBJECT_PATH_MAX]; 205175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *prop; 205275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 2053cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 2054cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 2055cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt 205675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen switch (property) { 205775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_SIGNAL: 205875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Signal"; 205975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 206075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_FREQ: 206175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Frequency"; 206275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 206375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_MODE: 206475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Mode"; 206575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 206675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_PRIVACY: 206775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Privacy"; 206875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 206975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_RATES: 207075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Rates"; 207175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 207275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_WPA: 207375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "WPA"; 207475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 207575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_RSN: 207675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "RSN"; 207775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 2078f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt case WPAS_DBUS_BSS_PROP_WPS: 2079f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt prop = "WPS"; 2080f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt break; 208175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_IES: 208275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "IEs"; 208375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 2084661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt case WPAS_DBUS_BSS_PROP_AGE: 2085661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt prop = "Age"; 2086661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt break; 208775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen default: 208875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d", 208975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__, property); 209075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 209175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 209275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 209375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX, 209475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u", 209575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, id); 209675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 209775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(wpa_s->global->dbus, path, 209875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_BSS, prop); 209975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 210075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 210175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 210275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 210375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_debug_level_changed - Signals change of debug param 210475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @global: wpa_global structure 210575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 210675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals informing that debug level has changed. 210775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 210875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_debug_level_changed(struct wpa_global *global) 210975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 211075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH, 211175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_INTERFACE, 211275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "DebugLevel"); 211375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 211475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 211575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 211675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 211775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_debug_timestamp_changed - Signals change of debug param 211875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @global: wpa_global structure 211975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 212075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals informing that debug timestamp has changed. 212175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 212275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global) 212375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 212475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH, 212575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_INTERFACE, 212675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "DebugTimestamp"); 212775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 212875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 212975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 213075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 213175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_debug_show_keys_changed - Signals change of debug param 213275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @global: wpa_global structure 213375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 213475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals informing that debug show_keys has changed. 213575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 213675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global) 213775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 213875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH, 213975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_INTERFACE, 214075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "DebugShowKeys"); 214175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 214275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 214375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 214475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_register(struct wpa_dbus_object_desc *obj_desc, 214575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen void *priv, 214675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPADBusArgumentFreeFunction priv_free, 214775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_dbus_method_desc *methods, 214875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_dbus_property_desc *properties, 214975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_dbus_signal_desc *signals) 215075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 215175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int n; 215275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 215375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->user_data = priv; 215475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->user_data_free_func = priv_free; 215575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->methods = methods; 215675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->properties = properties; 215775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->signals = signals; 215875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 215975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen for (n = 0; properties && properties->dbus_property; properties++) 216075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen n++; 216175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 216275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->prop_changed_flags = os_zalloc(n); 216375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc->prop_changed_flags) 216475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: %s: can't register handlers", 216575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__); 216675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 216775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 216875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 216975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_method_desc wpas_dbus_global_methods[] = { 21708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "CreateInterface", WPAS_DBUS_NEW_INTERFACE, 2171fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_create_interface, 21728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 21738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 21748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 21758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 21768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 21778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 21788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RemoveInterface", WPAS_DBUS_NEW_INTERFACE, 2179fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_remove_interface, 21808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 21818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_IN }, 21828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 21838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 21848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 21858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "GetInterface", WPAS_DBUS_NEW_INTERFACE, 2186fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_get_interface, 21878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 21888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "ifname", "s", ARG_IN }, 21898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 21908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 21918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 21928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2193d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { "ExpectDisconnect", WPAS_DBUS_NEW_INTERFACE, 2194d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_expect_disconnect, 2195d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { 2196d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt END_ARGS 2197d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 2198d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt }, 21998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, NULL, { END_ARGS } } 22008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 22018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_property_desc wpas_dbus_global_properties[] = { 22038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "DebugLevel", WPAS_DBUS_NEW_INTERFACE, "s", 22041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_debug_level, 2205d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_debug_level, 2206d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 22078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "DebugTimestamp", WPAS_DBUS_NEW_INTERFACE, "b", 22091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_debug_timestamp, 2210d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_debug_timestamp, 2211d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 22128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "DebugShowKeys", WPAS_DBUS_NEW_INTERFACE, "b", 22141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_debug_show_keys, 2215d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_debug_show_keys, 2216d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 22178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Interfaces", WPAS_DBUS_NEW_INTERFACE, "ao", 22191f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_interfaces, 2220d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 22211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 22228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "EapMethods", WPAS_DBUS_NEW_INTERFACE, "as", 22241f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_eap_methods, 2225d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 22261f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 22278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2228d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt { "Capabilities", WPAS_DBUS_NEW_INTERFACE, "as", 2229d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt wpas_dbus_getter_global_capabilities, 2230d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 2231d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt NULL 2232d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt }, 2233661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt#ifdef CONFIG_WIFI_DISPLAY 2234661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt { "WFDIEs", WPAS_DBUS_NEW_INTERFACE, "ay", 2235661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt wpas_dbus_getter_global_wfd_ies, 2236d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_global_wfd_ies, 2237d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 2238661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt }, 2239661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt#endif /* CONFIG_WIFI_DISPLAY */ 2240d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { NULL, NULL, NULL, NULL, NULL, NULL } 22418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 22428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_signal_desc wpas_dbus_global_signals[] = { 22448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "InterfaceAdded", WPAS_DBUS_NEW_INTERFACE, 22458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 22468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 22478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 22488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 22498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 22508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "InterfaceRemoved", WPAS_DBUS_NEW_INTERFACE, 22528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 22538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 22548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 22558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 22568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 22588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "PropertiesChanged", WPAS_DBUS_NEW_INTERFACE, 22598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 22608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 22618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 22628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 22638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, { END_ARGS } } 22658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 22668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2268d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtstatic char * uscore_to_dbus(const char *uscore) 2269d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt{ 2270d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt const char *p = uscore; 2271d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt char *str, *s; 2272d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt dbus_bool_t last_was_uscore = TRUE; 2273d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2274d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt s = str = os_zalloc(os_strlen(uscore) + 1); 2275d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (!str) 2276d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return NULL; 2277d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt while (p && *p) { 2278d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (*p == '_') { 2279d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt last_was_uscore = TRUE; 2280d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } else { 2281d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt *s++ = last_was_uscore ? toupper(*p) : *p; 2282d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt last_was_uscore = FALSE; 2283d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 2284d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt p++; 2285d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 2286d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2287d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return str; 2288d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt} 2289d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2290d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2291d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtstatic int wpa_dbus_ctrl_iface_props_init(struct wpas_dbus_priv *priv); 2292d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2293d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2294d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtstatic void wpa_dbus_ctrl_iface_props_deinit(struct wpas_dbus_priv *priv) 2295d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt{ 2296d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt int idx = priv->globals_start; 2297d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2298d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* Free all allocated property values */ 2299d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt while (priv->all_interface_properties[idx].dbus_property) 2300d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt os_free((char *) 2301d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt priv->all_interface_properties[idx++].dbus_property); 2302d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt os_free((char *) priv->all_interface_properties); 2303d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt} 2304d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2305d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 23068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 23078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_ctrl_iface_init - Initialize dbus control interface 23088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @global: Pointer to global data from wpa_supplicant_init() 23098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success or -1 on failure 23108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2311d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * Initialize the dbus control interface for wpa_supplicant and start 23128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * receiving commands from external programs over the bus. 23138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 23148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv) 23158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 23168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_dbus_object_desc *obj_desc; 23178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int ret; 23188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2319d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt ret = wpa_dbus_ctrl_iface_props_init(priv); 2320d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (ret < 0) { 2321d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpa_printf(MSG_ERROR, 2322d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt "dbus: Not enough memory to init interface properties"); 2323d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return -1; 2324d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 2325d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 23268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 23278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!obj_desc) { 2328fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 2329fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create object description"); 2330d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt goto error; 23318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 23328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_register(obj_desc, priv->global, NULL, 23348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_global_methods, 23358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_global_properties, 23368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_global_signals); 23378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Register D-Bus object '%s'", 23398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_PATH); 23408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ret = wpa_dbus_ctrl_iface_init(priv, WPAS_DBUS_NEW_PATH, 23418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_SERVICE, 23428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt obj_desc); 2343d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (ret < 0) { 23448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt free_dbus_object_desc(obj_desc); 2345d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt goto error; 2346d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 23478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2348d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt priv->dbus_new_initialized = 1; 2349d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return 0; 2350d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 2351d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidterror: 2352d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpa_dbus_ctrl_iface_props_deinit(priv); 2353d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return -1; 23548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 23558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 23588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_ctrl_iface_deinit - Deinitialize dbus ctrl interface for 23598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_supplicant 2360d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt * @priv: Pointer to dbus private data from wpas_dbus_init() 23618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 23628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Deinitialize the dbus control interface that was initialized with 23638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_ctrl_iface_init(). 23648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2365d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtvoid wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *priv) 23668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 2367d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (!priv->dbus_new_initialized) 23688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 23698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Unregister D-Bus object '%s'", 23708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_PATH); 2371d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt dbus_connection_unregister_object_path(priv->con, WPAS_DBUS_NEW_PATH); 2372d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpa_dbus_ctrl_iface_props_deinit(priv); 23738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 23748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpa_dbus_free(void *ptr) 23778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 23788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_free(ptr); 23798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 23808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_property_desc wpas_dbus_network_properties[] = { 23838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Properties", WPAS_DBUS_NEW_IFACE_NETWORK, "a{sv}", 23841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_network_properties, 2385d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_network_properties, 2386d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 23878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Enabled", WPAS_DBUS_NEW_IFACE_NETWORK, "b", 23891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_enabled, 2390d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_enabled, 2391d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 23928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2393d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { NULL, NULL, NULL, NULL, NULL, NULL } 23948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 23958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_signal_desc wpas_dbus_network_signals[] = { 23981f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 23998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_NETWORK, 24008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 24018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 24028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 24038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 24048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 24058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, { END_ARGS } } 24068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 24078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 24108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_register_network - Register a configured network with dbus 24118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: wpa_supplicant interface structure 24128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: network configuration data 24138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 24148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 24158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Registers network representing object with dbus 24168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 24178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_register_network(struct wpa_supplicant *wpa_s, 24188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_ssid *ssid) 24198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 24208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 24218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_dbus_object_desc *obj_desc; 24228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct network_handler_args *arg; 24238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 24248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2425c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt#ifdef CONFIG_P2P 242675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* 242775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * If it is a persistent group register it as such. 242875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This is to handle cases where an interface is being initialized 242975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * with a list of networks read from config. 243075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 243175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (network_is_persistent_group(ssid)) 243275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return wpas_dbus_register_persistent_group(wpa_s, ssid); 2433c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt#endif /* CONFIG_P2P */ 243475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 24358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 2436cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path) 24378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 24388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 24398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 24408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 24418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 24438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", 24448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, ssid->id); 24458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Register network object '%s'", 24478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt net_obj_path); 24488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 24498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!obj_desc) { 2450fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 2451fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create object description"); 24528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 24538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 24548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* allocate memory for handlers arguments */ 24568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg = os_zalloc(sizeof(struct network_handler_args)); 24578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!arg) { 2458fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 2459fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create arguments for method"); 24608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 24618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 24628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg->wpa_s = wpa_s; 24648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg->ssid = ssid; 24658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL, 24678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_network_properties, 24688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_network_signals); 24698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_dbus_register_object_per_iface(ctrl_iface, net_obj_path, 24718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->ifname, obj_desc)) 24728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 24738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network_added(wpa_s, ssid->id); 24758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 24778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 24798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt free_dbus_object_desc(obj_desc); 24808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 24818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 24828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 24858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_unregister_network - Unregister a configured network from dbus 24868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: wpa_supplicant interface structure 24878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @nid: network id 24888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 24898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 24908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Unregisters network representing object from dbus 24918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 24928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid) 24938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 24948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 24958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 24968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int ret; 249704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_P2P 249875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_ssid *ssid; 249975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 250075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ssid = wpa_config_get_network(wpa_s->conf, nid); 250175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 250275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* If it is a persistent group unregister it as such */ 250375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ssid && network_is_persistent_group(ssid)) 250475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return wpas_dbus_unregister_persistent_group(wpa_s, nid); 2505c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt#endif /* CONFIG_P2P */ 25068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 25081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (wpa_s->global == NULL || wpa_s->dbus_new_path == NULL) 25098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 25108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 25118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 25128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 25138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 25158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", 25168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, nid); 25178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Unregister network object '%s'", 25198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt net_obj_path); 25208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, net_obj_path); 25218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!ret) 25238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network_removed(wpa_s, nid); 25248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return ret; 25268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 25278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_property_desc wpas_dbus_bss_properties[] = { 25308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "SSID", WPAS_DBUS_NEW_IFACE_BSS, "ay", 25311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_ssid, 2532d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "BSSID", WPAS_DBUS_NEW_IFACE_BSS, "ay", 25361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_bssid, 2537d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Privacy", WPAS_DBUS_NEW_IFACE_BSS, "b", 25411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_privacy, 2542d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25431f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Mode", WPAS_DBUS_NEW_IFACE_BSS, "s", 25461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_mode, 2547d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Signal", WPAS_DBUS_NEW_IFACE_BSS, "n", 25511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_signal, 2552d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Frequency", WPAS_DBUS_NEW_IFACE_BSS, "q", 25561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_frequency, 2557d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25581f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Rates", WPAS_DBUS_NEW_IFACE_BSS, "au", 25611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_rates, 2562d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "WPA", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}", 25661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_wpa, 2567d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RSN", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}", 25711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_rsn, 2572d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2575d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt { "WPS", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}", 2576d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt wpas_dbus_getter_bss_wps, 2577d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 2578d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt NULL 2579d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt }, 25808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "IEs", WPAS_DBUS_NEW_IFACE_BSS, "ay", 25811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_ies, 2582d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 25831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 25848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2585661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt { "Age", WPAS_DBUS_NEW_IFACE_BSS, "u", 2586661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt wpas_dbus_getter_bss_age, 2587d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 2588661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt NULL 2589661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt }, 2590d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { NULL, NULL, NULL, NULL, NULL, NULL } 25918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 25928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_signal_desc wpas_dbus_bss_signals[] = { 25951f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 25968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_BSS, 25978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 25998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 26008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 26018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 26028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, { END_ARGS } } 26038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 26048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 26078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_unregister_bss - Unregister a scanned BSS from dbus 26088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: wpa_supplicant interface structure 26098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: scanned network bssid 26108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: unique BSS identifier 26118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 26128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 26138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Unregisters BSS representing object from dbus 26148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 26158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s, 26168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 bssid[ETH_ALEN], unsigned int id) 26178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 26188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 26198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 26208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 2622cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path) 26238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 26248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 26258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 26268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 26278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 26298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u", 26308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, id); 26318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Unregister BSS object '%s'", 26338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt bss_obj_path); 26348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_dbus_unregister_object_per_iface(ctrl_iface, bss_obj_path)) { 26358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Cannot unregister BSS object %s", 26368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt bss_obj_path); 26378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 26388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 26398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_bss_removed(wpa_s, bss_obj_path); 26418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSSS); 26428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 26448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 26458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 26488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_register_bss - Register a scanned BSS with dbus 26498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: wpa_supplicant interface structure 26508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: scanned network bssid 26518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: unique BSS identifier 26528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 26538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 26548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Registers BSS representing object with dbus 26558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 26568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_register_bss(struct wpa_supplicant *wpa_s, 26578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 bssid[ETH_ALEN], unsigned int id) 26588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 26598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 26608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_dbus_object_desc *obj_desc; 26618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 26628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct bss_handler_args *arg; 26638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 2665cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path) 26668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 26678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 26688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 26698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 26708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 26728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u", 26738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, id); 26748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 26768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!obj_desc) { 2677fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 2678fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create object description"); 26798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 26808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 26818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg = os_zalloc(sizeof(struct bss_handler_args)); 26838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!arg) { 2684fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 2685fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create arguments for handler"); 26868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 26878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 26888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg->wpa_s = wpa_s; 26898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg->id = id; 26908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL, 26928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_bss_properties, 26938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_bss_signals); 26948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 26958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Register BSS object '%s'", 26968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt bss_obj_path); 26978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_dbus_register_object_per_iface(ctrl_iface, bss_obj_path, 26988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->ifname, obj_desc)) { 26998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, 27008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "Cannot register BSSID dbus object %s.", 27018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt bss_obj_path); 27028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 27038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 27048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 27058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_bss_added(wpa_s, bss_obj_path); 27068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSSS); 27078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 27088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 27098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 27108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 27118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt free_dbus_object_desc(obj_desc); 27128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 27138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 27148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 27158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 27168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = { 27178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Scan", WPAS_DBUS_NEW_IFACE_INTERFACE, 2718fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_scan, 27198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 27208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 27218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 27228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 27238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2724661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt { "SignalPoll", WPAS_DBUS_NEW_IFACE_INTERFACE, 2725fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_signal_poll, 2726661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt { 2727661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt { "args", "a{sv}", ARG_OUT }, 2728661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt END_ARGS 2729661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt } 2730661b4f78e48c697429dc46154a4125892c001718Dmitry Shmidt }, 27318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Disconnect", WPAS_DBUS_NEW_IFACE_INTERFACE, 2732fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_disconnect, 27338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 27348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 27358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 27368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 27378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "AddNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, 2738fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_add_network, 27398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 27408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 27418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 27428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 27438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 27448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 274561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt { "Reassociate", WPAS_DBUS_NEW_IFACE_INTERFACE, 2746fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_reassociate, 274761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt { 274861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt END_ARGS 274961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt } 275061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt }, 27519866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt { "Reattach", WPAS_DBUS_NEW_IFACE_INTERFACE, 2752fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_reattach, 27539866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt { 27549866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt END_ARGS 27559866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt } 27569866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt }, 2757a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt { "Reconnect", WPAS_DBUS_NEW_IFACE_INTERFACE, 2758a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_reconnect, 2759a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt { 2760a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt END_ARGS 2761a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt } 2762a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt }, 27638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RemoveNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, 2764fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_remove_network, 27658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 27668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_IN }, 27678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 27688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 27698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 27708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RemoveAllNetworks", WPAS_DBUS_NEW_IFACE_INTERFACE, 2771fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_remove_all_networks, 27728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 27738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 27748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 27758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 27768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "SelectNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, 2777fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_select_network, 27788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 27798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_IN }, 27808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 27818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 27828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 27831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "NetworkReply", WPAS_DBUS_NEW_IFACE_INTERFACE, 2784fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_network_reply, 27851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { 27861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "path", "o", ARG_IN }, 27871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "field", "s", ARG_IN }, 27881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "value", "s", ARG_IN }, 27891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt END_ARGS 27901f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt } 27911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt }, 2792700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt#ifndef CONFIG_NO_CONFIG_BLOBS 27938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "AddBlob", WPAS_DBUS_NEW_IFACE_INTERFACE, 2794fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_add_blob, 27958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 27968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "name", "s", ARG_IN }, 27978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "data", "ay", ARG_IN }, 27988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 27998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 28008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "GetBlob", WPAS_DBUS_NEW_IFACE_INTERFACE, 2802fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_get_blob, 28038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 28048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "name", "s", ARG_IN }, 28058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "data", "ay", ARG_OUT }, 28068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 28078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 28088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RemoveBlob", WPAS_DBUS_NEW_IFACE_INTERFACE, 2810fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_remove_blob, 28118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 28128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "name", "s", ARG_IN }, 28138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 28148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 28158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2816700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt#endif /* CONFIG_NO_CONFIG_BLOBS */ 281701904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "SetPKCS11EngineAndModulePath", WPAS_DBUS_NEW_IFACE_INTERFACE, 281801904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt (WPADBusMethodHandler) 2819fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpas_dbus_handler_set_pkcs11_engine_and_module_path, 282001904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { 282101904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "pkcs11_engine_path", "s", ARG_IN }, 282201904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "pkcs11_module_path", "s", ARG_IN }, 282301904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt END_ARGS 282401904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt } 282501904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt }, 28268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS 28278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Start", WPAS_DBUS_NEW_IFACE_WPS, 2828fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_wps_start, 28298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 28308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 28318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "output", "a{sv}", ARG_OUT }, 28328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 28338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 28348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2835b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt { "Cancel", WPAS_DBUS_NEW_IFACE_WPS, 2836b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_wps_cancel, 2837b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt { 2838b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt END_ARGS 2839b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt } 2840b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt }, 28418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */ 284275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 284375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Find", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2844fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_find, 284575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 284675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 284775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 284875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 284975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 285075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "StopFind", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2851fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_stop_find, 285275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 285375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 285475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 285575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 285675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Listen", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2857fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_listen, 285875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 285975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "timeout", "i", ARG_IN }, 286075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 286175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 286275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 286375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ExtendedListen", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2864fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_extendedlisten, 286575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 286675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 286775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 286875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 286975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 287075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PresenceRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2871fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_presence_request, 287275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 287375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 287475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 287575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 287675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 287775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2878fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_prov_disc_req, 287975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 288075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer", "o", ARG_IN }, 288175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "config_method", "s", ARG_IN }, 288275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 288375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 288475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 288575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Connect", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2886fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_connect, 288775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 288875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 28891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "generated_pin", "s", ARG_OUT }, 289075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 289175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 289275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 289375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GroupAdd", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2894fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_group_add, 289575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 289675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 289775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 289875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 289975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 2900b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt { "Cancel", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2901b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_cancel, 2902b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt { 2903b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt END_ARGS 2904b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt } 2905b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt }, 290675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Invite", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2907fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_invite, 290875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 290975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 291075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 291175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 291275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 291375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Disconnect", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2914fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_disconnect, 291575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 291675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 291775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 291875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 291975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "RejectPeer", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2920fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_rejectpeer, 292175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 292275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer", "o", ARG_IN }, 292375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 292475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 292575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 2926a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt { "RemoveClient", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2927a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_remove_client, 2928a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt { 2929a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 2930a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt END_ARGS 2931a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt } 2932a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt }, 293375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Flush", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2934fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_flush, 293575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 293675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 293775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 293875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 293975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "AddService", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2940fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_add_service, 294175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 294275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 294375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 294475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 294575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 294675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "DeleteService", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2947fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_delete_service, 294875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 294975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 295075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 295175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 295275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 295375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "FlushService", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2954fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_flush_service, 295575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 295675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 295775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 295875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 295975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2960fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_service_sd_req, 296175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 296275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 2963d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt { "ref", "t", ARG_OUT }, 296475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 296575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 296675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 296775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2968fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_service_sd_res, 296975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 297075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 297175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 297275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 297375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 297475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryCancelRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2975fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_service_sd_cancel_req, 297675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 297775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "t", ARG_IN }, 297875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 297975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 298075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 298175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceUpdate", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2982fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_service_update, 298375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 298475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 298575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 298675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 298775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryExternal", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 2988fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_p2p_serv_disc_external, 298975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 299075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "arg", "i", ARG_IN }, 299175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 299275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 299375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 299475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "AddPersistentGroup", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 299575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler) wpas_dbus_handler_add_persistent_group, 299675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 299775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 299875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 299975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 300075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 300175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 300275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "RemovePersistentGroup", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 300375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler) wpas_dbus_handler_remove_persistent_group, 300475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 300575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_IN }, 300675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 300775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 300875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 300975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "RemoveAllPersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 301075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler) 301175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_handler_remove_all_persistent_groups, 301275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 301375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 301475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 301575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 301675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */ 30178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "FlushBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, 3018fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_flush_bss, 30198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 30208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "age", "u", ARG_IN }, 30218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 30228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 30238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 302404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_AP 302504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "SubscribeProbeReq", WPAS_DBUS_NEW_IFACE_INTERFACE, 302604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_subscribe_preq, 302704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 302804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt END_ARGS 302904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 303004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 303104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "UnsubscribeProbeReq", WPAS_DBUS_NEW_IFACE_INTERFACE, 303204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_unsubscribe_preq, 303304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 303404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt END_ARGS 303504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 303604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 303704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_AP */ 30388da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt { "EAPLogoff", WPAS_DBUS_NEW_IFACE_INTERFACE, 3039fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_eap_logoff, 30408da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt { 30418da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt END_ARGS 30428da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt } 30438da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt }, 30448da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt { "EAPLogon", WPAS_DBUS_NEW_IFACE_INTERFACE, 3045fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_eap_logon, 30468da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt { 30478da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt END_ARGS 30488da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt } 30498da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt }, 305034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt#ifdef CONFIG_AUTOSCAN 305134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "AutoScan", WPAS_DBUS_NEW_IFACE_INTERFACE, 3052fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_autoscan, 305334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { 305434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "arg", "s", ARG_IN }, 305534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt END_ARGS 305634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt } 305734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt }, 305834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt#endif /* CONFIG_AUTOSCAN */ 3059e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt#ifdef CONFIG_TDLS 3060e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "TDLSDiscover", WPAS_DBUS_NEW_IFACE_INTERFACE, 3061e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_tdls_discover, 3062e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { 3063e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "peer_address", "s", ARG_IN }, 3064e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt END_ARGS 3065e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt } 3066e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt }, 3067e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "TDLSSetup", WPAS_DBUS_NEW_IFACE_INTERFACE, 3068e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_tdls_setup, 3069e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { 3070e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "peer_address", "s", ARG_IN }, 3071e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt END_ARGS 3072e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt } 3073e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt }, 3074e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "TDLSStatus", WPAS_DBUS_NEW_IFACE_INTERFACE, 3075e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_tdls_status, 3076e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { 3077e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "peer_address", "s", ARG_IN }, 3078e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "status", "s", ARG_OUT }, 3079e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt END_ARGS 3080e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt } 3081e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt }, 3082e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "TDLSTeardown", WPAS_DBUS_NEW_IFACE_INTERFACE, 3083e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_tdls_teardown, 3084e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { 3085e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "peer_address", "s", ARG_IN }, 3086e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt END_ARGS 3087e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt } 3088e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt }, 3089e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt#endif /* CONFIG_TDLS */ 309055840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "VendorElemAdd", WPAS_DBUS_NEW_IFACE_INTERFACE, 309155840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_vendor_elem_add, 309255840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { 309355840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "frame_id", "i", ARG_IN }, 309455840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "ielems", "ay", ARG_IN }, 309555840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt END_ARGS 309655840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt } 309755840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt }, 309855840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "VendorElemGet", WPAS_DBUS_NEW_IFACE_INTERFACE, 309955840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_vendor_elem_get, 310055840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { 310155840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "frame_id", "i", ARG_IN }, 310255840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "ielems", "ay", ARG_OUT }, 310355840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt END_ARGS 310455840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt } 310555840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt }, 310655840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "VendorElemRem", WPAS_DBUS_NEW_IFACE_INTERFACE, 310755840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_vendor_elem_remove, 310855840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { 310955840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "frame_id", "i", ARG_IN }, 311055840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt { "ielems", "ay", ARG_IN }, 311155840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt END_ARGS 311255840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt } 311355840adb6cd32ca52064f327b72a40e769f70661Dmitry Shmidt }, 3114b70d0bbd90f638aa38da542e337c312309200e87Dmitry Shmidt#ifndef CONFIG_NO_CONFIG_WRITE 3115b70d0bbd90f638aa38da542e337c312309200e87Dmitry Shmidt { "SaveConfig", WPAS_DBUS_NEW_IFACE_INTERFACE, 3116b70d0bbd90f638aa38da542e337c312309200e87Dmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_save_config, 3117b70d0bbd90f638aa38da542e337c312309200e87Dmitry Shmidt { 3118b70d0bbd90f638aa38da542e337c312309200e87Dmitry Shmidt END_ARGS 3119b70d0bbd90f638aa38da542e337c312309200e87Dmitry Shmidt } 3120b70d0bbd90f638aa38da542e337c312309200e87Dmitry Shmidt }, 3121b70d0bbd90f638aa38da542e337c312309200e87Dmitry Shmidt#endif /* CONFIG_NO_CONFIG_WRITE */ 31228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, NULL, { END_ARGS } } 31238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 31248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 31258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = { 31268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Capabilities", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{sv}", 31271f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_capabilities, 3128d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 31291f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 31308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "State", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 31321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_state, 3133d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 31341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 31358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Scanning", WPAS_DBUS_NEW_IFACE_INTERFACE, "b", 31371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_scanning, 3138d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 31391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 31408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "ApScan", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", 31421f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_ap_scan, 3143d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_ap_scan, 3144d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 31458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 3146092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart#ifdef CONFIG_IEEE80211W 3147092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart { "Pmf", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", 3148092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart wpas_dbus_getter_pmf, 3149092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart wpas_dbus_setter_pmf, 3150092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart NULL 3151092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart }, 3152092955c7394ee96d6c8c9724ff46a3c038b36143Paul Stewart#endif /* CONFIG_IEEE80211W */ 31538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "BSSExpireAge", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", 31541f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_expire_age, 3155d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_bss_expire_age, 3156d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 31578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "BSSExpireCount", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", 31591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_expire_count, 3160d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_bss_expire_count, 3161d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 31628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Country", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 31641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_country, 3165d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_country, 3166d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 31678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Ifname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 31691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_ifname, 3170d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 31711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 31728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Driver", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 31741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_driver, 3175d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 31761f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 31778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "BridgeIfname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 31791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bridge_ifname, 3180d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 31811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 31828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 31837d17530e229db79208e99741071df97ea4faeec6Dmitry Shmidt { "ConfigFile", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 31847d17530e229db79208e99741071df97ea4faeec6Dmitry Shmidt wpas_dbus_getter_config_file, 31857d17530e229db79208e99741071df97ea4faeec6Dmitry Shmidt NULL, 31867d17530e229db79208e99741071df97ea4faeec6Dmitry Shmidt NULL 31877d17530e229db79208e99741071df97ea4faeec6Dmitry Shmidt }, 31888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "CurrentBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o", 31891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_current_bss, 3190d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 31911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 31928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 319375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "CurrentNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, "o", 31941f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_current_network, 3195d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 31961f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 319775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 319875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "CurrentAuthMode", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 31991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_current_auth_mode, 3200d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 32011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 320275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 320375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Blobs", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{say}", 32041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_blobs, 3205d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 32061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 320775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 320875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BSSs", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao", 32091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bsss, 3210d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 32111f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 321275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 321375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Networks", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao", 32141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_networks, 3215d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 32161f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 321775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 3218c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "FastReauth", WPAS_DBUS_NEW_IFACE_INTERFACE, "b", 3219c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_fast_reauth, 3220d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_fast_reauth, 3221d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 3222c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 322304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "ScanInterval", WPAS_DBUS_NEW_IFACE_INTERFACE, "i", 322404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_scan_interval, 3225d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_scan_interval, 3226d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 322704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 322801904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "PKCS11EnginePath", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 322901904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt wpas_dbus_getter_pkcs11_engine_path, 3230d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 323101904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt NULL 323201904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt }, 323301904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "PKCS11ModulePath", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 323401904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt wpas_dbus_getter_pkcs11_module_path, 3235d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 323601904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt NULL 323701904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt }, 323875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_WPS 323975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b", 32401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_process_credentials, 3241d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_process_credentials, 3242d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 324375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 32449ead16e203b81d44a2d84eadc2901ceeb7daf805Dmitry Shmidt { "ConfigMethods", WPAS_DBUS_NEW_IFACE_WPS, "s", 32459ead16e203b81d44a2d84eadc2901ceeb7daf805Dmitry Shmidt wpas_dbus_getter_config_methods, 3246d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_config_methods, 3247d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 32489ead16e203b81d44a2d84eadc2901ceeb7daf805Dmitry Shmidt }, 3249293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt { 3250293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt "DeviceName", WPAS_DBUS_NEW_IFACE_WPS, "s", 3251293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_getter_wps_device_name, 3252293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_setter_wps_device_name, 3253293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt NULL 3254293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt }, 3255293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt { 3256293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt "Manufacturer", WPAS_DBUS_NEW_IFACE_WPS, "s", 3257293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_getter_wps_manufacturer, 3258293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_setter_wps_manufacturer, 3259293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt NULL 3260293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt }, 3261293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt { 3262293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt "ModelName", WPAS_DBUS_NEW_IFACE_WPS, "s", 3263293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_getter_wps_device_model_name, 3264293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_setter_wps_device_model_name, 3265293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt NULL 3266293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt }, 3267293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt { 3268293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt "ModelNumber", WPAS_DBUS_NEW_IFACE_WPS, "s", 3269293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_getter_wps_device_model_number, 3270293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_setter_wps_device_model_number, 3271293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt NULL 3272293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt }, 3273293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt { 3274293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt "SerialNumber", WPAS_DBUS_NEW_IFACE_WPS, "s", 3275293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_getter_wps_device_serial_number, 3276293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_setter_wps_device_serial_number, 3277293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt NULL 3278293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt }, 3279293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt { 3280293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt "DeviceType", WPAS_DBUS_NEW_IFACE_WPS, "ay", 3281293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_getter_wps_device_device_type, 3282293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt wpas_dbus_setter_wps_device_device_type, 3283293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt NULL 3284293335998d38c497293b1c41f7ad8342b507d458Dmitry Shmidt }, 328575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_WPS */ 328675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 328704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}", 328804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_device_config, 3289d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_p2p_device_config, 3290d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 329175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 329275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Peers", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao", 32931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_peers, 3294d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 32951f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 329675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 329775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Role", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "s", 32981f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_role, 3299d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 33001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 330175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 330275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Group", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o", 33031f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_group, 3304d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 33051f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 330675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 330775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PeerGO", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o", 33081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_peergo, 3309d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 33101f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 331175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 331275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao", 33131f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_persistent_groups, 3314d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 33151f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 331675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 331775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */ 331804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "DisconnectReason", WPAS_DBUS_NEW_IFACE_INTERFACE, "i", 331904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_disconnect_reason, 3320d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 332104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 332204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 332331a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt { "AssocStatusCode", WPAS_DBUS_NEW_IFACE_INTERFACE, "i", 332431a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt wpas_dbus_getter_assoc_status_code, 332531a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt NULL, 332631a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt NULL 332731a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt }, 3328d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { NULL, NULL, NULL, NULL, NULL, NULL } 332975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 333075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 333175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = { 333275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ScanDone", WPAS_DBUS_NEW_IFACE_INTERFACE, 333375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 333475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "success", "b", ARG_OUT }, 333575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 333675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 333775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 333875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BSSAdded", WPAS_DBUS_NEW_IFACE_INTERFACE, 333975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 334075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 334175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 334275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 334375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 334475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 334575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BSSRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE, 334675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 334775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 334875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 334975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 335075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 335175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BlobAdded", WPAS_DBUS_NEW_IFACE_INTERFACE, 335275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 335375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "name", "s", ARG_OUT }, 335475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 335575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 335675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 335775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BlobRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE, 335875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 335975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "name", "s", ARG_OUT }, 336075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 336175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 336275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 336375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "NetworkAdded", WPAS_DBUS_NEW_IFACE_INTERFACE, 336475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 336575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 336675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 336775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 336875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 336975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 337075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "NetworkRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE, 337175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 337275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 337375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 337475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 337575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 337675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "NetworkSelected", WPAS_DBUS_NEW_IFACE_INTERFACE, 337775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 337875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 337975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 338075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 338175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 33821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 338375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_INTERFACE, 338475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 338575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 338675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 338775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 338875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 338975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_WPS 339075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Event", WPAS_DBUS_NEW_IFACE_WPS, 339175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 339275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "name", "s", ARG_OUT }, 339375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_OUT }, 339475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 339575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 339675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 339775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Credentials", WPAS_DBUS_NEW_IFACE_WPS, 339875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 339975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "credentials", "a{sv}", ARG_OUT }, 340075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 340175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 340275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 34031f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 340475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_WPS, 340575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 340675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 340775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 340875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 340975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 341075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_WPS */ 341175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 341275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "DeviceFound", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 341375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 341475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 341575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 341675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 341775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 34184ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt { "DeviceFoundProperties", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 34194ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt { 34204ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt { "path", "o", ARG_OUT }, 34214ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 34224ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt END_ARGS 34234ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt } 34244ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt }, 342575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "DeviceLost", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 342675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 342775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 342875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 342975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 343075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 34318bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt { "FindStopped", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 34328bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt { 34338bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt END_ARGS 34348bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt } 34358bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt }, 343675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryRequestDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 343775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 343875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 343975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "pin", "s", ARG_OUT }, 344075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 344175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 34428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 344375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryResponseDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 344475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 344575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 344675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "pin", "s", ARG_OUT }, 344775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 344875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 34498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 345075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryRequestEnterPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 345175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 345275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 345375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 345475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 34558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 345675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryResponseEnterPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 345775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 345875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 345975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 346075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 34618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 346275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryPBCRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 346375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 346475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 346575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 346675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 34678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 346875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryPBCResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 346975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 347075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 347175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 347275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 34738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 347475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 34758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 347675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 347775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "status", "i", ARG_OUT }, 34788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 34798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 34808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 348175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GroupStarted", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 34828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 34838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 34848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 34858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 34868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 3487d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { "GroupFormationFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 3488d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { 3489d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { "reason", "s", ARG_OUT }, 3490d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt END_ARGS 3491d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 3492d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt }, 349375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GONegotiationSuccess", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 349475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 349550b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 349675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 349775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 349875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 349975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GONegotiationFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 350075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 350150b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 350275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 350375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 350475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 350575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GONegotiationRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 35068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 35078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 3508d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { "dev_passwd_id", "q", ARG_OUT }, 35097a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt { "device_go_intent", "y", ARG_OUT }, 35108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 35118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 35128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 351375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "InvitationResult", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 35148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 351575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "invite_result", "a{sv}", ARG_OUT }, 35168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 35178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 35188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 351975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GroupFinished", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 35208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 352103658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 35228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 35238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 35248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 352575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 35268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 352775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "sd_request", "a{sv}", ARG_OUT }, 35288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 35298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 35308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 353175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 35328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 353375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "sd_response", "a{sv}", ARG_OUT }, 35348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 35358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 35368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 353775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PersistentGroupAdded", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 35388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 35398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 354075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 35418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 35428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 35438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 3544c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { "PersistentGroupRemoved", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 3545c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { 3546c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { "path", "o", ARG_OUT }, 3547c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt END_ARGS 3548c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt } 3549c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt }, 355075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "WpsFailed", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 35518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 355275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "name", "s", ARG_OUT }, 355375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_OUT }, 35548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 35558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 35568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 3557d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { "InvitationReceived", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 3558d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { 3559d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 3560d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt END_ARGS 3561d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 3562d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt }, 356375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */ 356404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_AP 356504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "ProbeRequest", WPAS_DBUS_NEW_IFACE_INTERFACE, 356604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 356704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "args", "a{sv}", ARG_OUT }, 356804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt END_ARGS 356904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 357004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 357104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_AP */ 3572c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { "Certification", WPAS_DBUS_NEW_IFACE_INTERFACE, 3573c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { 3574c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { "certification", "a{sv}", ARG_OUT }, 3575c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt END_ARGS 3576c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt } 3577c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt }, 357804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "EAP", WPAS_DBUS_NEW_IFACE_INTERFACE, 357904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 358004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "status", "s", ARG_OUT }, 358104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "parameter", "s", ARG_OUT }, 358204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt END_ARGS 358304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 358404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 358534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "StaAuthorized", WPAS_DBUS_NEW_IFACE_INTERFACE, 358634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { 358734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "name", "s", ARG_OUT }, 358834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt END_ARGS 358934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt } 359034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt }, 359134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "StaDeauthorized", WPAS_DBUS_NEW_IFACE_INTERFACE, 359234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { 359334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "name", "s", ARG_OUT }, 359434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt END_ARGS 359534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt } 359634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt }, 3597fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt { "NetworkRequest", WPAS_DBUS_NEW_IFACE_INTERFACE, 3598fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt { 3599fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt { "path", "o", ARG_OUT }, 3600fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt { "field", "s", ARG_OUT }, 3601fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt { "text", "s", ARG_OUT }, 3602fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt END_ARGS 3603fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt } 3604fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt }, 360575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { NULL, NULL, { END_ARGS } } 360675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 360775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 360875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 3609d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtstatic int wpa_dbus_ctrl_iface_props_init(struct wpas_dbus_priv *priv) 3610d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt{ 3611d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt size_t all_size; 3612d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt unsigned int i, j, count, num_const, num_globals; 3613d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt const char *global_name; 3614d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt static const char * const ignored_globals[] = { 3615d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt "bss_expiration_age", "bss_expiration_scan_count", 3616d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt "ap_scan", "country", "fast_reauth", 3617d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt "pkcs11_engine_path", "pkcs11_module_path" 3618d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt }; 3619d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3620d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* wpas_dbus_interface_properties terminates with a NULL element */ 3621d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt num_const = ARRAY_SIZE(wpas_dbus_interface_properties) - 1; 3622d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3623d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt num_globals = wpa_config_get_num_global_field_names(); 3624d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt priv->globals_start = num_const; 3625d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3626d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* allocate enough for all properties + terminating NULL element */ 3627d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt all_size = (num_globals + num_const + 1) * 3628d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt sizeof(wpas_dbus_interface_properties[0]); 3629d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt priv->all_interface_properties = os_zalloc(all_size); 3630d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (!priv->all_interface_properties) { 3631d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpa_printf(MSG_ERROR, 3632d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt "dbus: Not enough memory for interface properties"); 3633d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return -1; 3634d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 3635d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3636d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* Copy constant interface properties to the start of the array */ 3637d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt os_memcpy(priv->all_interface_properties, 3638d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_interface_properties, 3639d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt sizeof(wpas_dbus_interface_properties)); 3640d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3641d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* Dynamically construct interface global properties */ 3642d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt for (i = 0, count = num_const; i < num_globals; i++) { 3643d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt struct wpa_dbus_property_desc *desc; 3644d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt int no_var = 0; 3645d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3646d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* ignore globals that are actually just methods */ 3647d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt global_name = wpa_config_get_global_field_name(i, &no_var); 3648d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (no_var) 3649d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt continue; 3650d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt /* Ignore fields already explicitly exposed */ 3651d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt for (j = 0; j < ARRAY_SIZE(ignored_globals); j++) { 3652d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (os_strcmp(global_name, ignored_globals[j]) == 0) 3653d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt break; 3654d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 3655d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (j < ARRAY_SIZE(ignored_globals)) 3656d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt continue; 3657d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3658d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt desc = &priv->all_interface_properties[count++]; 3659d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt desc->dbus_property = uscore_to_dbus(global_name); 3660d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt if (!desc->dbus_property) { 3661d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpa_printf(MSG_ERROR, 3662d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt "dbus: Not enough memory for D-Bus property name"); 3663d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt goto error; 3664d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 3665d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt desc->dbus_interface = WPAS_DBUS_NEW_IFACE_INTERFACE; 3666d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt desc->type = "s"; 3667d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt desc->getter = wpas_dbus_getter_iface_global; 3668d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt desc->setter = wpas_dbus_setter_iface_global; 3669d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt desc->data = global_name; 3670d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt } 3671d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3672d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return 0; 3673d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3674d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidterror: 3675d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpa_dbus_ctrl_iface_props_deinit(priv); 3676d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt return -1; 3677d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt} 3678d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 3679d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt 36804171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt/** 36814171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * wpas_dbus_register_interface - Register an interface with D-Bus 36824171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @wpa_s: wpa_supplicant interface structure 36834171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * Returns: 0 on success, -1 on failure 36844171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt */ 368575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_register_interface(struct wpa_supplicant *wpa_s) 368675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 368775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_dbus_object_desc *obj_desc = NULL; 368875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface = wpa_s->global->dbus; 368975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int next; 369075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 369175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 369275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 369375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 369475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 369575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Create and set the interface's object path */ 369675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX); 369775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_new_path == NULL) 369875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 369975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen next = ctrl_iface->next_objid++; 370075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(wpa_s->dbus_new_path, WPAS_DBUS_OBJECT_PATH_MAX, 370175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_PATH_INTERFACES "/%u", 370275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen next); 370375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 370475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 370575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc) { 3706fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 3707fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create object description"); 370875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 370975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 371075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 371175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_register(obj_desc, wpa_s, NULL, wpas_dbus_interface_methods, 3712d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt ctrl_iface->all_interface_properties, 371375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_interface_signals); 371475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 371575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Register interface object '%s'", 371675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path); 371775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_register_object_per_iface(ctrl_iface, 371875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, 371975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->ifname, obj_desc)) 372075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 372175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 372275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_interface_added(wpa_s); 372375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 372475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 372575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 372675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 372775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_free(wpa_s->dbus_new_path); 372875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path = NULL; 372975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen free_dbus_object_desc(obj_desc); 373075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 373175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 373275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 373375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 37344171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt/** 37354171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * wpas_dbus_unregister_interface - Unregister the interface from D-Bus 37364171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @wpa_s: wpa_supplicant interface structure 37374171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * Returns: 0 on success, -1 on failure 37384171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt */ 373975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s) 374075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 374175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 374275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 374375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 374475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 374575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 374675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 3747746bde5f922dfd627d25111da4313395bc4ed6afDmitry Shmidt if (ctrl_iface == NULL || wpa_s->dbus_new_path == NULL) 374875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 374975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 375075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Unregister interface object '%s'", 375175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path); 375204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 375304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_AP 375404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (wpa_s->preq_notify_peer) { 375504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_unsubscribe_noc(ctrl_iface); 375604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt os_free(wpa_s->preq_notify_peer); 375704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_s->preq_notify_peer = NULL; 375804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 375904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_AP */ 376004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 376175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_unregister_object_per_iface(ctrl_iface, 376275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path)) 376375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 376475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 376575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_interface_removed(wpa_s); 376675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 376775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_free(wpa_s->dbus_new_path); 376875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path = NULL; 376975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 377075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 377175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 377275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 377375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 377475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 377575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = { 3776c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "DeviceName", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s", 3777c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_device_name, 3778d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3779c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3780c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3781b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt { "Manufacturer", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s", 3782b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt wpas_dbus_getter_p2p_peer_manufacturer, 3783d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3784b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt NULL 3785b1e52102c211357f585e9ff6d54501e90254326eDmitry Shmidt }, 37867a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt { "ModelName", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s", 37877a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt wpas_dbus_getter_p2p_peer_modelname, 3788d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 37897a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt NULL 37907a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt }, 37917a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt { "ModelNumber", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s", 37927a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt wpas_dbus_getter_p2p_peer_modelnumber, 3793d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 37947a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt NULL 37957a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt }, 37967a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt { "SerialNumber", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s", 37977a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt wpas_dbus_getter_p2p_peer_serialnumber, 3798d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 37997a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt NULL 38007a53dbb56693ee9f55c0cab1a8297436511e8613Dmitry Shmidt }, 3801c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "PrimaryDeviceType", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay", 3802c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_primary_device_type, 3803d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3804c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3805c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3806c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "config_method", WPAS_DBUS_NEW_IFACE_P2P_PEER, "q", 3807c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_config_method, 3808d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3809c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3810c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3811c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "level", WPAS_DBUS_NEW_IFACE_P2P_PEER, "i", 3812c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_level, 3813d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3814c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3815c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3816c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "devicecapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y", 3817c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_device_capability, 3818d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3819c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3820c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3821c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "groupcapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y", 3822c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_group_capability, 3823d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3824c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3825c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 382604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "SecondaryDeviceTypes", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay", 3827c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_secondary_device_types, 3828d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3829c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3830c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 383104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "VendorExtension", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay", 3832c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_vendor_extension, 3833d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 38341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 383575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 383675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "IEs", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay", 38371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_peer_ies, 3838d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 38391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 384075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 3841d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt { "DeviceAddress", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay", 3842d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt wpas_dbus_getter_p2p_peer_device_address, 3843d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3844d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt NULL 3845d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt }, 3846d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt { "Groups", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ao", 3847d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpas_dbus_getter_p2p_peer_groups, 3848d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 3849d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt NULL 3850d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt }, 3851d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { NULL, NULL, NULL, NULL, NULL, NULL } 385275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 385375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 385475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_signal_desc wpas_dbus_p2p_peer_signals[] = { 3855d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 3856d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_P2P_PEER, 3857d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt { 3858d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 3859d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt END_ARGS 3860d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt } 3861d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt }, 386275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { NULL, NULL, { END_ARGS } } 386375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 386475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 386575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 386675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_peer - Send a peer related event signal 386775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 386875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev: peer device object 386975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @interface: name of the interface emitting this signal. 387075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * In case of peer objects, it would be emitted by either 387175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * the "interface object" or by "peer objects" 387275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @sig_name: signal name - DeviceFound 38734ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt * @properties: Whether to add a second argument with object properties 387475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 38754ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt * Notify listeners about event related with p2p peer device 387675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 387775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s, 387875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr, const char *interface, 38794ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt const char *sig_name, int properties) 388075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 388175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 388275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 388375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 388475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 388575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 3886fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 3887fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 3888fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 388975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 389075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 389175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 3892cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 389375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 389475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 389575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 389675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 389775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(dev_addr)); 389875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 389975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, interface, 390075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen sig_name); 390175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 390275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 390375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 390475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 390575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 390675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 39074ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt &path) || 39084ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt (properties && !wpa_dbus_get_object_properties( 39094ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt iface, peer_obj_path, WPAS_DBUS_NEW_IFACE_P2P_PEER, 39104ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt &iter))) 3911fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 3912fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt else 3913fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 391475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 391575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 391675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 391775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 391875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 391975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 392075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_peer_found - Send a peer found signal 392175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 39224171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @dev_addr: Peer P2P Device Address 392375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 392475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about find a p2p peer device found 392575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 392675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s, 392775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr) 392875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 392975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_peer(wpa_s, dev_addr, 393075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 39314ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt "DeviceFound", FALSE); 39324ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt 39334ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt wpas_dbus_signal_peer(wpa_s, dev_addr, 39344ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt WPAS_DBUS_NEW_IFACE_P2PDEVICE, 39354ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt "DeviceFoundProperties", TRUE); 393675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 393775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 393875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 393975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_peer_lost - Send a peer lost signal 394075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 39414171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @dev_addr: Peer P2P Device Address 394275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 394375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about lost a p2p peer device 394475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 394575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s, 394675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr) 394775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 394875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_peer(wpa_s, dev_addr, 394975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 39504ae50e65ef0eefe6d5c356acbc1839f8eac68af5Dmitry Shmidt "DeviceLost", FALSE); 395175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 395275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 395375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 395475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_register_peer - Register a discovered peer object with dbus 395575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 3956a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt * @dev_addr: P2P Device Address of the peer 395775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 395875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 395975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Registers network representing object with dbus 396075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 396175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr) 396275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 396375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 396475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_dbus_object_desc *obj_desc; 396575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct peer_handler_args *arg; 396675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 396775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 396875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 396975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 397075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 397175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 397275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 397375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 397475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 397575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 3976cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt wpa_s = wpa_s->parent->parent; 3977cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 3978cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return 0; 3979fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 398075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 398175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 398275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(dev_addr)); 398375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 398475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_INFO, "dbus: Register peer object '%s'", 398575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen peer_obj_path); 398675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 398775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc) { 3988fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 3989fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create object description"); 399075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 399175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 399275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 399375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* allocate memory for handlers arguments */ 399475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg = os_zalloc(sizeof(struct peer_handler_args)); 399575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!arg) { 3996fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 3997fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create arguments for method"); 399875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 399975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 400075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 400175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg->wpa_s = wpa_s; 400275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_memcpy(arg->p2p_device_addr, dev_addr, ETH_ALEN); 400375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 400475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_register(obj_desc, arg, wpa_dbus_free, 400575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen NULL, 400675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_p2p_peer_properties, 400775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_p2p_peer_signals); 400875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 400975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_register_object_per_iface(ctrl_iface, peer_obj_path, 401075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->ifname, obj_desc)) 401175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 401275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 401375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 401475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 401575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 401675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen free_dbus_object_desc(obj_desc); 401775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 401875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 401975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 402075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 402175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_unregister_peer - Unregister a peer object with dbus 402275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 402375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev_addr: p2p device addr 402475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 402575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 402675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Registers network representing object with dbus 402775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 402875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s, 402975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr) 403075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 403175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 403275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 403375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int ret; 403475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 403575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 4036cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (wpa_s == NULL || wpa_s->global == NULL) 403775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 4038fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 4039cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt wpa_s = wpa_s->parent->parent; 4040cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 4041cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return 0; 4042fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 404375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 404475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 404575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 404675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 404775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 404875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 404975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(dev_addr)); 405075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 405175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_INFO, "dbus: Unregister peer object '%s'", 405275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen peer_obj_path); 405375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, peer_obj_path); 405475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 405575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return ret; 405675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 405775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 405875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 40598bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt/** 40608bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt * wpas_dbus_signal_p2p_find_stopped - Send P2P Find stopped signal 40618bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 40628bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt * 40638bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt * Notify listeners about P2P Find stopped 40648bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt */ 40658bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidtvoid wpas_dbus_signal_p2p_find_stopped(struct wpa_supplicant *wpa_s) 40668bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt{ 40678bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt struct wpas_dbus_priv *iface; 40688bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt DBusMessage *msg; 40698bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt 40708bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt iface = wpa_s->global->dbus; 40718bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt 40728bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt /* Do nothing if the control interface is not turned on */ 40738bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt if (iface == NULL || !wpa_s->dbus_new_path) 40748bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt return; 40758bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt 40768bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 40778bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt WPAS_DBUS_NEW_IFACE_P2PDEVICE, 40788bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt "FindStopped"); 40798bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt if (msg == NULL) 40808bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt return; 40818bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt 40828bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 40838bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt 40848bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt dbus_message_unref(msg); 40858bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt} 40868bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt 40878bd70b7d6ba220544ee2f0e201e5df23e277fa1dDmitry Shmidt 40884171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt/** 40894171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * wpas_dbus_signal_peer_groups_changed - Send peer group change property signal 40904171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 40914171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * @dev_addr: P2P Device Address 40924171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * 40934171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt * Notify listeners about peer Groups property changes. 40944171258d30a612645aa061cede62233b5c58ca2aDmitry Shmidt */ 4095d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtvoid wpas_dbus_signal_peer_groups_changed(struct wpa_supplicant *wpa_s, 4096d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt const u8 *dev_addr) 4097d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt{ 4098d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 4099d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 4100fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 4101fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 4102fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 4103cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 4104cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return; 4105d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 4106d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 4107d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_s->dbus_new_path, MAC2STR(dev_addr)); 4108d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 4109d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_dbus_mark_property_changed(wpa_s->global->dbus, peer_obj_path, 4110d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt WPAS_DBUS_NEW_IFACE_P2P_PEER, "Groups"); 4111d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt} 4112d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 4113d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 411475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_property_desc wpas_dbus_p2p_group_properties[] = { 411575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Members", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ao", 41161f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_group_members, 4117d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 41181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 411975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 412004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "Group", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "o", 412104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group, 4122d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 412304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 412404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 412504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "Role", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s", 412604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_role, 4127d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 412804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 412904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 413004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "SSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay", 413104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_ssid, 4132d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 413304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 413404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 413504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "BSSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay", 413604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_bssid, 4137d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 413804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 413904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 414004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "Frequency", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "q", 414104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_frequency, 4142d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 414304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 414404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 414504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "Passphrase", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s", 414604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_passphrase, 4147d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 414804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 414904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 415004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "PSK", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay", 415104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_psk, 4152d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL, 415304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 415404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 415504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "WPSVendorExtensions", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "aay", 415604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_vendor_ext, 4157d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_p2p_group_vendor_ext, 4158d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 41598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 4160d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { NULL, NULL, NULL, NULL, NULL, NULL } 416175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 416275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 416375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_signal_desc wpas_dbus_p2p_group_signals[] = { 416475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PeerJoined", WPAS_DBUS_NEW_IFACE_P2P_GROUP, 41658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 416675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer", "o", ARG_OUT }, 41678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 41688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 41698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 417075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PeerDisconnected", WPAS_DBUS_NEW_IFACE_P2P_GROUP, 41718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 417275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer", "o", ARG_OUT }, 41738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 41748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 41758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 41768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, { END_ARGS } } 41778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 41788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 417975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 418075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_register_p2p_group - Register a p2p group object with dbus 418175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 418275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ssid: SSID struct 418375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 418475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 418575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Registers p2p group representing object with dbus 418675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 418775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s, 418875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_ssid *ssid) 418975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 419075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 419175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_dbus_object_desc *obj_desc; 419275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char group_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 419375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 419475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 419575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 419675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 41978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 419875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 419975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 420075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 420175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 420275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_groupobj_path) { 420375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_INFO, "%s: Group object '%s' already exists", 420475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__, wpa_s->dbus_groupobj_path); 420575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 420675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 420775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 420875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpas_dbus_get_group_obj_path(wpa_s, ssid, group_obj_path) < 0) 420975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 421075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 421175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path = os_strdup(group_obj_path); 421275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_groupobj_path == NULL) 421375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 421475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 421575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_INFO, "dbus: Register group object '%s'", 421675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen group_obj_path); 421775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 421875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc) { 4219fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 4220fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "Not enough memory to create object description"); 422175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 422275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 422375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 422475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_register(obj_desc, wpa_s, NULL, NULL, 422575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_p2p_group_properties, 422675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_p2p_group_signals); 422775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 422875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_register_object_per_iface(ctrl_iface, group_obj_path, 422975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->ifname, obj_desc)) 423075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 423175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 423275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 423375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 423475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 423575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_groupobj_path) { 423675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_free(wpa_s->dbus_groupobj_path); 423775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path = NULL; 423875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 423975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 424075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen free_dbus_object_desc(obj_desc); 424175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 424275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 424375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 424475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_unregister_p2p_group - Unregister a p2p group object from dbus 424575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 424675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ssid: network name of the p2p group started 424775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 424875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s, 424975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_ssid *ssid) 42508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 425175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 425275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 425375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 425475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 425575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 425675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 4257fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 4258fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 4259fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 426075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 426175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 426275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 426375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 426475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_s->dbus_groupobj_path) { 426575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, 426675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s: Group object '%s' already unregistered", 426775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__, wpa_s->dbus_groupobj_path); 426875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 426975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 427075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 4271d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt peer_groups_changed(wpa_s); 4272d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 427375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Unregister group object '%s'", 427475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path); 427575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 427675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_unregister_object_per_iface(ctrl_iface, 427775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path); 427875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 427975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_free(wpa_s->dbus_groupobj_path); 428075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path = NULL; 428175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 428275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 428375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_property_desc 428475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_persistent_group_properties[] = { 428575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Properties", WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, "a{sv}", 428675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_getter_persistent_group_properties, 4287d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt wpas_dbus_setter_persistent_group_properties, 4288d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt NULL 428975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 4290d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt { NULL, NULL, NULL, NULL, NULL, NULL } 429175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 429275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 429375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/* No signals intended for persistent group objects */ 429475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 429575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 429675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_register_persistent_group - Register a configured(saved) 429775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * persistent group with dbus 429875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 429975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ssid: persistent group (still represented as a network within wpa) 430075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * configuration data 430175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 430275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 430375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Registers a persistent group representing object with dbus. 430475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 430575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_register_persistent_group(struct wpa_supplicant *wpa_s, 430675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_ssid *ssid) 430775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 430875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 430975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_dbus_object_desc *obj_desc; 431075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct network_handler_args *arg; 431175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 431275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 431375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 431475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 431575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 4316cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt wpa_s = wpa_s->parent->parent; 4317cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (!wpa_s->dbus_new_path) 4318cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt return 0; 431975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 432075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Make sure ssid is a persistent group */ 432175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ssid->disabled != 2 && !ssid->p2p_persistent_group) 432275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; /* should we return w/o complaining? */ 432375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 4324fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt if (wpa_s->p2p_mgmt) 4325fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_s = wpa_s->parent; 4326fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 432775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 432875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 432975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 433075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 433175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* 433275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Intentionally not coming up with different numbering scheme 433375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * for persistent groups. 433475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 433575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 433675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u", 433775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, ssid->id); 433875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 433975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Register persistent group object '%s'", 434075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen pgrp_obj_path); 434175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 434275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc) { 4343fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 4344fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "dbus: Not enough memory to create object description"); 434575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 434675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 434775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 434875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* 434975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Reusing the same context structure as that for networks 435075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * since these are represented using same data structure. 435175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 435275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* allocate memory for handlers arguments */ 435375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg = os_zalloc(sizeof(struct network_handler_args)); 435475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!arg) { 4355fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt wpa_printf(MSG_ERROR, 4356fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt "dbus: Not enough memory to create arguments for method"); 435775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 435875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 435975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 436075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg->wpa_s = wpa_s; 436175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg->ssid = ssid; 436275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 436375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL, 436475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_persistent_group_properties, 436575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen NULL); 436675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 436775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_register_object_per_iface(ctrl_iface, pgrp_obj_path, 436875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->ifname, obj_desc)) 436975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 437075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 437175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_persistent_group_added(wpa_s, ssid->id); 43728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 43738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 43748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 43758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 43768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt free_dbus_object_desc(obj_desc); 43778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 43788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 43798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 43808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 438175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 438275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_unregister_persistent_group - Unregister a persistent_group 438375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * from dbus 438475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 438575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @nid: network id 438675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 438775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 438875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Unregisters persistent group representing object from dbus 438975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 439075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * NOTE: There is a slight issue with the semantics here. While the 439175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * implementation simply means the persistent group is unloaded from memory, 439275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * it should not get interpreted as the group is actually being erased/removed 439375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * from persistent storage as well. 439475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 439575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s, 439675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int nid) 43978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 43988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 439975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 440075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int ret; 44018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 44028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 4403cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (wpa_s == NULL || wpa_s->global == NULL) 44048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 4405fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 4406cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt wpa_s = wpa_s->parent->parent; 4407fb45fd5cfed8bdccd0859c7fc05449fc187e2d06Dmitry Shmidt 44088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 4409cc00d5dc8483e32158b2ba61ea44b0c38d790ed7Dmitry Shmidt if (ctrl_iface == NULL || !wpa_s->dbus_new_path) 44108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 44118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 441275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 441375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u", 441475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, nid); 44158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 441675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Unregister persistent group object '%s'", 441775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen pgrp_obj_path); 441875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, pgrp_obj_path); 44198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 442075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!ret) 442175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_persistent_group_removed(wpa_s, nid); 44228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 442375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return ret; 44248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 442575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 442675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */ 4427