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 7804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt for (wpa_s = priv->global->ifaces; wpa_s; wpa_s = wpa_s->next) 7904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 8004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (wpa_s->preq_notify_peer != NULL && 8104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt os_strcmp(name, wpa_s->preq_notify_peer) == 0 && 8204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt (new_owner == NULL || os_strlen(new_owner) == 0)) { 8304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /* probe request owner disconnected */ 8404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt os_free(wpa_s->preq_notify_peer); 8504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_s->preq_notify_peer = NULL; 8604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_unsubscribe_noc(priv); 8704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 8804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 8904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 9004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 9104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 9204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt} 9304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 9404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 9504949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid wpas_dbus_subscribe_noc(struct wpas_dbus_priv *priv) 9604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt{ 9704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt priv->dbus_noc_refcnt++; 9804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (priv->dbus_noc_refcnt > 1) 9904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 10004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 10104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (!dbus_connection_add_filter(priv->con, noc_filter, priv, NULL)) { 10204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_printf(MSG_ERROR, "dbus: failed to add filter"); 10304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 10404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 10504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 10604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_bus_add_match(priv->con, wpas_dbus_noc_filter_str, NULL); 10704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt} 10804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 10904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 11004949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid wpas_dbus_unsubscribe_noc(struct wpas_dbus_priv *priv) 11104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt{ 11204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt priv->dbus_noc_refcnt--; 11304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (priv->dbus_noc_refcnt > 0) 11404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 11504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 11604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_bus_remove_match(priv->con, wpas_dbus_noc_filter_str, NULL); 11704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_connection_remove_filter(priv->con, noc_filter, priv); 11804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt} 11904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 12004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_AP */ 12104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_interface - Send a interface related event signal 1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sig_name: signal name - InterfaceAdded or InterfaceRemoved 1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @properties: Whether to add second argument with object properties 1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about event related with interface 1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_interface(struct wpa_supplicant *wpa_s, 1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *sig_name, int properties) 1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 1361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(WPAS_DBUS_NEW_PATH, 1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_INTERFACE, sig_name); 1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt &wpa_s->dbus_new_path)) 1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (properties) { 1551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_get_object_properties( 1561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt iface, wpa_s->dbus_new_path, 1571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, &iter)) 1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_interface_added - Send a interface created signal 1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about creating new interface 1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_interface_added(struct wpa_supplicant *wpa_s) 1788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_interface(wpa_s, "InterfaceAdded", TRUE); 1808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 1818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_interface_removed - Send a interface removed signal 1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about removing interface 1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_interface_removed(struct wpa_supplicant *wpa_s) 1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_interface(wpa_s, "InterfaceRemoved", FALSE); 1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 1978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_scan_done - send scan done signal 1988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @success: indicates if scanning succeed or failed 2008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about finishing a scan 2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success) 2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 2068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 2078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_bool_t succ; 2088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 2168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 2178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "ScanDone"); 2188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 2198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt succ = success ? TRUE : FALSE; 2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &succ, 2238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBUS_TYPE_INVALID)) 2248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 2258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 2268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 2278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 2288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 2298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_blob - Send a BSS related event signal 2338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 2348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bss_obj_path: BSS object path 2358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sig_name: signal name - BSSAdded or BSSRemoved 2368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @properties: Whether to add second argument with object properties 2378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about event related with BSS 2398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_bss(struct wpa_supplicant *wpa_s, 2418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *bss_obj_path, 2428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *sig_name, int properties) 2438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 2448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 2458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 2461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sig_name); 2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt &bss_obj_path)) 2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (properties) { 2661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_get_object_properties(iface, bss_obj_path, 2671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt WPAS_DBUS_NEW_IFACE_BSS, 2681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter)) 2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 2778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_bss_added - Send a BSS added signal 2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bss_obj_path: new BSS object path 2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 2878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about adding new BSS 2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_bss_added(struct wpa_supplicant *wpa_s, 2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *bss_obj_path) 2918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 2928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_bss(wpa_s, bss_obj_path, "BSSAdded", TRUE); 2938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 2978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_bss_removed - Send a BSS removed signal 2988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 2998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bss_obj_path: BSS object path 3008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about removing BSS 3028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_bss_removed(struct wpa_supplicant *wpa_s, 3048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *bss_obj_path) 3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_bss(wpa_s, bss_obj_path, "BSSRemoved", FALSE); 3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_blob - Send a blob related event signal 3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @name: blob name 3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sig_name: signal name - BlobAdded or BlobRemoved 3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about event related with blob 3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_blob(struct wpa_supplicant *wpa_s, 3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *name, const char *sig_name) 3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 3288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 3298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 3318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 3328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sig_name); 3338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 3348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 3358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, 3378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBUS_TYPE_INVALID)) 3388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 3398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 3408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 3418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 3428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 3438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 3468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_blob_added - Send a blob added signal 3478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 3488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @name: blob name 3498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about adding a new blob 3518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s, 3538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *name) 3548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_blob(wpa_s, name, "BlobAdded"); 3568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 3578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 3608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_blob_removed - Send a blob removed signal 3618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 3628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @name: blob name 3638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about removing blob 3658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s, 3678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const char *name) 3688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_blob(wpa_s, name, "BlobRemoved"); 3708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 3718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 3748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network - Send a network related event signal 3758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 3768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: new network id 3778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @sig_name: signal name - NetworkAdded, NetworkRemoved or NetworkSelected 3788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @properties: determines if add second argument with object properties 3798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 3808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about event related with configured network 3818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 3828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_network(struct wpa_supplicant *wpa_s, 3838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int id, const char *sig_name, 3848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int properties) 3858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 3868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 3878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 3881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 3898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 3908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 3928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 3948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 3958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 3968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 3978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 3988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", 3998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, id); 4008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 4028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 4038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sig_name); 4048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 4058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 4068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 4088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt path = net_obj_path; 4098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 4108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt &path)) 4118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 4128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (properties) { 4141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_get_object_properties( 4151f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt iface, net_obj_path, WPAS_DBUS_NEW_IFACE_NETWORK, 4161f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter)) 4178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 4188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 4198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 4218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 4238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 4248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 4268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 4278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 4288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 4298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 4328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network_added - Send a network added signal 4338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 4348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: new network id 4358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about adding new network 4378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_network_added(struct wpa_supplicant *wpa_s, 4398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int id) 4408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 4418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network(wpa_s, id, "NetworkAdded", TRUE); 4428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 4438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 4468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network_removed - Send a network removed signal 4478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 4488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: network id 4498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about removing a network 4518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_dbus_signal_network_removed(struct wpa_supplicant *wpa_s, 4538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int id) 4548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 4558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network(wpa_s, id, "NetworkRemoved", FALSE); 4568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 4578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 4608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network_selected - Send a network selected signal 4618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 4628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: network id 4638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 4648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Notify listeners about selecting a network 4658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 4668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id) 4678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 4688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network(wpa_s, id, "NetworkSelected", FALSE); 4698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 4708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 4728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 4731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * wpas_dbus_signal_network_request - Indicate that additional information 4741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * (EAP password, etc.) is required to complete the association to this SSID 4751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 4761f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @rtype: The specific additional information required 4771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * @default_text: Optional description of required information 4781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * 4791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * Request additional information or passwords to complete an association 4801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * request. 4811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */ 4821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtvoid wpas_dbus_signal_network_request(struct wpa_supplicant *wpa_s, 4831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt struct wpa_ssid *ssid, 4841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt enum wpa_ctrl_req_type rtype, 4851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const char *default_txt) 4861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt{ 4871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt struct wpas_dbus_priv *iface; 4881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessage *msg; 4891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 4901f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 4911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt const char *field, *txt = NULL, *net_ptr; 4921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt iface = wpa_s->global->dbus; 4941f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4951f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Do nothing if the control interface is not turned on */ 4961f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (iface == NULL) 4971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt return; 4981f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 4991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt field = wpa_supplicant_ctrl_req_to_string(rtype, default_txt, &txt); 5001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (field == NULL) 5011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt return; 5021f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 5031f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 5041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 5051f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "NetworkRequest"); 5061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (msg == NULL) 5071f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt return; 5081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 5091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 5101f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", 5111f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpa_s->dbus_new_path, ssid->id); 5121f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt net_ptr = &net_obj_path[0]; 5131f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 5141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_message_iter_init_append(msg, &iter); 5151f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 5161f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &net_ptr)) 5171f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 5181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &field)) 5191f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 5201f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &txt)) 5211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 5221f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 5231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 5241f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_message_unref(msg); 5251f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt return; 5261f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 5271f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidterr: 5281f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 5291f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_message_unref(msg); 5301f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt} 5311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 5321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 5331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/** 5348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_network_enabled_changed - Signals Enabled property changes 5358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 5368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: configured network which Enabled property has changed 5378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends PropertyChanged signals containing new value of Enabled property 5398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for specified network 5408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s, 5428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_ssid *ssid) 5438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 5448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char path[WPAS_DBUS_OBJECT_PATH_MAX]; 5468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX, 5478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d", 5488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, ssid->id); 5498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_dbus_mark_property_changed(wpa_s->global->dbus, path, 5518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_NETWORK, "Enabled"); 5528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 5538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS 5568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 5588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_wps_event_success - Signals Success WPS event 5598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 5608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends Event dbus signal with name "success" and empty dict as arguments 5628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 5638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s) 5648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 5658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 5678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessageIter iter, dict_iter; 5688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 5698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *key = "success"; 5708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 5728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 5748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 5758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 5768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 5788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, "Event"); 5798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 5808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 5818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 5838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 5858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_open_write(&iter, &dict_iter) || 5868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 5878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 5888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 5898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 5908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 5928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 5938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 5968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_wps_event_fail - Signals Fail WPS event 5978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 5988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 5998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends Event dbus signal with name "fail" and dictionary containing 6008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * "msg field with fail message number (int32) as arguments 6018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s, 6038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_event_fail *fail) 6048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 6058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 6078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessageIter iter, dict_iter; 6088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 6098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *key = "fail"; 6108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 6128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 6148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 6158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 6168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 6188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, "Event"); 6198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 6208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 6218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 6238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 6258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_open_write(&iter, &dict_iter) || 6268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "msg", fail->msg) || 6278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 6288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 6298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 6308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 6318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 6338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 6348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 6378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_wps_event_m2d - Signals M2D WPS event 6388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 6398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 6408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends Event dbus signal with name "m2d" and dictionary containing 6418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * fields of wps_event_m2d structure. 6428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 6438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s, 6448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wps_event_m2d *m2d) 6458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 6468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 6488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessageIter iter, dict_iter; 6498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 6508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char *key = "m2d"; 6518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 6538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 6558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 6568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 6578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 6598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, "Event"); 6608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 6618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 6628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 6648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 6668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_open_write(&iter, &dict_iter) || 6678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_uint16(&dict_iter, "config_methods", 6688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->config_methods) || 6698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "manufacturer", 6708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) m2d->manufacturer, 6718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->manufacturer_len) || 6728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "model_name", 6738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) m2d->model_name, 6748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->model_name_len) || 6758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "model_number", 6768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) m2d->model_number, 6778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->model_number_len) || 6788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "serial_number", 6798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) 6808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->serial_number, 6818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->serial_number_len) || 6828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "dev_name", 6838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) m2d->dev_name, 6848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->dev_name_len) || 6858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "primary_dev_type", 6868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) 6878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->primary_dev_type, 8) || 6888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_uint16(&dict_iter, "config_error", 6898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->config_error) || 6908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_uint16(&dict_iter, "dev_password_id", 6918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt m2d->dev_password_id) || 6928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 6938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 6948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 6958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 6968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 6978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 6988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 6998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 7028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_signal_wps_cred - Signals new credentials 7038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 7048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 7058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Sends signal with credentials in directory argument 7068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 7078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s, 7088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const struct wps_credential *cred) 7098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 7108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessage *msg; 7118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt DBusMessageIter iter, dict_iter; 7128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *iface; 71321de214b4ba4271ca20843f3b8fba9f1501b2a89Dmitry Shmidt char *auth_type[5]; /* we have five possible authentication types */ 7148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int at_num = 0; 71521de214b4ba4271ca20843f3b8fba9f1501b2a89Dmitry Shmidt char *encr_type[3]; /* we have three possible encryption types */ 7168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int et_num = 0; 7178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt iface = wpa_s->global->dbus; 7198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 7218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (iface == NULL) 7228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 7238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 7258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_IFACE_WPS, 7268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "Credentials"); 7278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (msg == NULL) 7288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 7298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_iter_init_append(msg, &iter); 7318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 7328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto nomem; 7338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_OPEN) 7358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt auth_type[at_num++] = "open"; 7368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_WPAPSK) 7378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt auth_type[at_num++] = "wpa-psk"; 7388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_WPA) 7398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt auth_type[at_num++] = "wpa-eap"; 7408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_WPA2) 7418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt auth_type[at_num++] = "wpa2-eap"; 7428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->auth_type & WPS_AUTH_WPA2PSK) 74321de214b4ba4271ca20843f3b8fba9f1501b2a89Dmitry Shmidt auth_type[at_num++] = "wpa2-psk"; 7448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->encr_type & WPS_ENCR_NONE) 7468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt encr_type[et_num++] = "none"; 7478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->encr_type & WPS_ENCR_TKIP) 7488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt encr_type[et_num++] = "tkip"; 7498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (cred->encr_type & WPS_ENCR_AES) 7508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt encr_type[et_num++] = "aes"; 7518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_s->current_ssid) { 7538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!wpa_dbus_dict_append_byte_array( 7548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt &dict_iter, "BSSID", 7558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) wpa_s->current_ssid->bssid, 7568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ETH_ALEN)) 7578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto nomem; 7588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 7598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!wpa_dbus_dict_append_byte_array(&dict_iter, "SSID", 7618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) cred->ssid, 7628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt cred->ssid_len) || 7638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_string_array(&dict_iter, "AuthType", 7648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char **) auth_type, 7658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt at_num) || 7668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_string_array(&dict_iter, "EncrType", 7678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char **) encr_type, 7688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt et_num) || 7698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "Key", 7708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (const char *) cred->key, 7718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt cred->key_len) || 7728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_append_uint32(&dict_iter, "KeyIndex", 7738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt cred->key_idx) || 7748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 7758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto nomem; 7768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 7788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtnomem: 7808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_message_unref(msg); 7818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 7828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 7838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */ 7848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 785c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidtvoid wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s, 786c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt int depth, const char *subject, 787c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt const char *cert_hash, 788c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt const struct wpabuf *cert) 789c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt{ 790c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt struct wpas_dbus_priv *iface; 791c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt DBusMessage *msg; 792c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt DBusMessageIter iter, dict_iter; 793c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 794c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt iface = wpa_s->global->dbus; 795c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 796c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt /* Do nothing if the control interface is not turned on */ 797c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt if (iface == NULL) 798c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt return; 799c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 800c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 801c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 802c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt "Certification"); 803c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt if (msg == NULL) 804c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt return; 805c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 806c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt dbus_message_iter_init_append(msg, &iter); 807c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 808c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt goto nomem; 809c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 810c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt if (!wpa_dbus_dict_append_uint32(&dict_iter, "depth", depth) || 811c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "subject", subject)) 812c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt goto nomem; 813c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 814c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt if (cert_hash && 815c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "cert_hash", cert_hash)) 816c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt goto nomem; 817c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 818c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt if (cert && 819c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "cert", 820c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt wpabuf_head(cert), 821c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt wpabuf_len(cert))) 822c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt goto nomem; 823c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 824c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) 825c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt goto nomem; 826c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 827c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 828c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 829c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidtnomem: 830c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt dbus_message_unref(msg); 831c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt} 832c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt 83304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 83404949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s, 83504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt const char *status, const char *parameter) 83604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt{ 83704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt struct wpas_dbus_priv *iface; 83804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBusMessage *msg; 83904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt DBusMessageIter iter; 84004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 84104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt iface = wpa_s->global->dbus; 84204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 84304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt /* Do nothing if the control interface is not turned on */ 84404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (iface == NULL) 84504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 84604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 84704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 84804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, 84904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt "EAP"); 85004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (msg == NULL) 85104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt return; 85204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 85304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_message_iter_init_append(msg, &iter); 85404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 85504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &status) 85604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt || 85704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt !dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, 85804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt ¶meter)) 85904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt goto nomem; 86004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 86104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 86204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 86304949598a23f501be6eec21697465fd46a28840aDmitry Shmidtnomem: 86404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_message_unref(msg); 86504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt} 86604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 86704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 86834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt/** 86934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * wpas_dbus_signal_sta - Send a station related event signal 87034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 87134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @sta: station mac address 87234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @sig_name: signal name - StaAuthorized or StaDeauthorized 87334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * 87434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * Notify listeners about event related with station 87534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt */ 87634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidtstatic void wpas_dbus_signal_sta(struct wpa_supplicant *wpa_s, 87734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt const u8 *sta, const char *sig_name) 87834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt{ 87934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt struct wpas_dbus_priv *iface; 88034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt DBusMessage *msg; 88134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt char sta_mac[WPAS_DBUS_OBJECT_PATH_MAX]; 88234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt char *dev_mac; 88334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 88434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt os_snprintf(sta_mac, WPAS_DBUS_OBJECT_PATH_MAX, MACSTR, MAC2STR(sta)); 88534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt dev_mac = sta_mac; 88634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 88734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt iface = wpa_s->global->dbus; 88834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 88934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 89034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt if (iface == NULL) 89134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt return; 89234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 89334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->dbus_new_path, 89434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt WPAS_DBUS_NEW_IFACE_INTERFACE, sig_name); 89534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt if (msg == NULL) 89634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt return; 89734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 89834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &dev_mac, 89934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt DBUS_TYPE_INVALID)) 90034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 90134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt else 90234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 90334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt dbus_message_unref(msg); 90434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 90534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Station MAC address '%s' '%s'", 90634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt sta_mac, sig_name); 90734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt} 90834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 90934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 91034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt/** 91134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * wpas_dbus_signal_sta_authorized - Send a STA authorized signal 91234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 91334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @sta: station mac address 91434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * 91534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * Notify listeners a new station has been authorized 91634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt */ 91734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidtvoid wpas_dbus_signal_sta_authorized(struct wpa_supplicant *wpa_s, 91834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt const u8 *sta) 91934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt{ 92034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt wpas_dbus_signal_sta(wpa_s, sta, "StaAuthorized"); 92134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt} 92234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 92334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 92434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt/** 92534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * wpas_dbus_signal_sta_deauthorized - Send a STA deauthorized signal 92634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 92734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * @sta: station mac address 92834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * 92934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt * Notify listeners a station has been deauthorized 93034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt */ 93134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidtvoid wpas_dbus_signal_sta_deauthorized(struct wpa_supplicant *wpa_s, 93234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt const u8 *sta) 93334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt{ 93434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt wpas_dbus_signal_sta(wpa_s, sta, "StaDeauthorized"); 93534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt} 93634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 93734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt 93875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 9398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 94175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_p2p_group_removed - Signals P2P group was removed 9428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: %wpa_supplicant network interface data 94375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @role: role of this device (client or GO) 94475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends signal with i/f name and role as string arguments 9458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 94675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s, 94775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const char *role) 9488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 94903658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt int error = 1; 95075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 95103658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt DBusMessageIter iter, dict_iter; 95275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface = wpa_s->global->dbus; 9538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 95475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 95575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 9568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 95775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 95803658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt if (!wpa_s->dbus_groupobj_path) 95903658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt return; 96003658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt 96103658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt msg = dbus_message_new_signal(wpa_s->parent->dbus_new_path, 96275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 96375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "GroupFinished"); 96475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 96575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 96675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 96775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 96803658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 96903658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt goto nomem; 97075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 97103658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt if (!wpa_dbus_dict_append_object_path(&dict_iter, 97203658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt "interface_object", 97303658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt wpa_s->dbus_new_path)) 97403658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt goto nomem; 9758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 97603658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt if (!wpa_dbus_dict_append_string(&dict_iter, "role", role)) 97703658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt goto nomem; 97803658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt 97903658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt if (!wpa_dbus_dict_append_object_path(&dict_iter, "group_object", 98003658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt wpa_s->dbus_groupobj_path) || 98103658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt !wpa_dbus_dict_close_write(&iter, &dict_iter)) 98203658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt goto nomem; 98303658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt 98403658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt error = 0; 98503658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt dbus_connection_send(iface->con, msg, NULL); 98603658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt 98703658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidtnomem: 98803658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt if (error > 0) 98903658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt wpa_printf(MSG_ERROR, 99003658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt "dbus: Failed to construct GroupFinished"); 99175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 99275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 9938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 9948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 9968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 99775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_p2p_provision_discovery - Signals various PD events 9988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 99975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev_addr - who sent the request or responded to our request. 100075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @request - Will be 1 if request, 0 for response. 100175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @status - valid only in case of response 100275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @config_methods - wps config methods 100375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @generated_pin - pin to be displayed in case of WPS_CONFIG_DISPLAY method 100475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 100575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends following provision discovery related events: 100675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryRequestDisplayPin 100775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryResponseDisplayPin 100875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryRequestEnterPin 100975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryResponseEnterPin 101075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryPBCRequest 101175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryPBCResponse 101275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 101375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * TODO:: 101475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * ProvisionDiscoveryFailure (timeout case) 10158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 101675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s, 101775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr, int request, 101875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen enum p2p_prov_disc_status status, 101975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen u16 config_methods, 102075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen unsigned int generated_pin) 10218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 102275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 102375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 102475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 102575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *_signal; 102675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int add_pin = 0; 102775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 102875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int error_ret = 1; 102975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char pin[9], *p_pin = NULL; 10308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 103175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 103275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 103375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 103475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 10358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 103675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 103775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (request || !status) { 103875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (config_methods & WPS_CONFIG_DISPLAY) 103975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen _signal = request ? 104075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryRequestDisplayPin" : 104175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryResponseEnterPin"; 104275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else if (config_methods & WPS_CONFIG_KEYPAD) 104375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen _signal = request ? 104475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryRequestEnterPin" : 104575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryResponseDisplayPin"; 104675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else if (config_methods & WPS_CONFIG_PUSHBUTTON) 104775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen _signal = request ? "ProvisionDiscoveryPBCRequest" : 104875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ProvisionDiscoveryPBCResponse"; 104975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 105075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; /* Unknown or un-supported method */ 105175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } else if (!request && status) 105275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Explicit check for failure response */ 105375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen _signal = "ProvisionDiscoveryFailure"; 105475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 105575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen add_pin = ((request && (config_methods & WPS_CONFIG_DISPLAY)) || 105675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (!request && !status && 105775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (config_methods & WPS_CONFIG_KEYPAD))); 105875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 105975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (add_pin) { 106075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(pin, sizeof(pin), "%08d", generated_pin); 106175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen p_pin = pin; 10628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 10638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 106475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 106575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, _signal); 106675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 106775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 10688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 106975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Check if this is a known peer */ 10701f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!p2p_peer_known(wpa_s->global->p2p, dev_addr)) 107175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 107275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 107375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 107475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 107575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, 107675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(dev_addr)); 107775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 107875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 107975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 108075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 108175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 108275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, 108375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBUS_TYPE_OBJECT_PATH, 108475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &path)) 108575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 108675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 108775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!request && status) 108875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Attach status to ProvisionDiscoveryFailure */ 108975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen error_ret = !dbus_message_iter_append_basic(&iter, 109075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBUS_TYPE_INT32, 109175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &status); 109275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 109375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen error_ret = (add_pin && 109475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !dbus_message_iter_append_basic(&iter, 109575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBUS_TYPE_STRING, 109675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &p_pin)); 109775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 109875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerror: 109975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!error_ret) 110075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 110175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 110275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 110375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 110475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 11058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 11068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 110875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s, 110975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *src, u16 dev_passwd_id) 11108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 111175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 111275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 111375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 111475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 111575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 111675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 111775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 111875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 111975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 112075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 112175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 112275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 112375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 112475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(src)); 112575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 112675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 112775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 112875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 112975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "GONegotiationRequest"); 113075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 113175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 113275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 113375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 113475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 113575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 113675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &path) || 113775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT16, 113875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &dev_passwd_id)) 113975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 114075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 114175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 114275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 114375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 114475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 114575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 114675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 114775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic int wpas_dbus_get_group_obj_path(struct wpa_supplicant *wpa_s, 114875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_ssid *ssid, 114975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *group_obj_path) 115075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 115175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char group_name[3]; 115275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 115375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (os_memcmp(ssid->ssid, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)) 115475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 115575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 115604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt os_memcpy(group_name, ssid->ssid + P2P_WILDCARD_SSID_LEN, 2); 115775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen group_name[2] = '\0'; 115875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 115975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(group_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 116075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_GROUPS_PART "/%s", 116175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, group_name); 116275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 116375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 11648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 11658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 11668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1167d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtstruct group_changed_data { 1168d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct wpa_supplicant *wpa_s; 1169d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct p2p_peer_info *info; 1170d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt}; 1171d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1172d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1173d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtstatic int match_group_where_peer_is_client(struct p2p_group *group, 1174d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void *user_data) 1175d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt{ 1176d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct group_changed_data *data = user_data; 1177d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt const struct p2p_group_config *cfg; 1178d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct wpa_supplicant *wpa_s_go; 1179d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1180d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt if (!p2p_group_is_client_connected(group, data->info->p2p_device_addr)) 1181d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt return 1; 1182d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1183d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt cfg = p2p_group_get_config(group); 1184d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1185d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_s_go = wpas_get_p2p_go_iface(data->wpa_s, cfg->ssid, 1186d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt cfg->ssid_len); 1187d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt if (wpa_s_go != NULL && wpa_s_go == data->wpa_s) { 1188d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpas_dbus_signal_peer_groups_changed( 1189d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt data->wpa_s->parent, data->info->p2p_device_addr); 1190d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt return 0; 1191d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt } 1192d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1193d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt return 1; 1194d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt} 1195d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1196d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1197d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtstatic void signal_peer_groups_changed(struct p2p_peer_info *info, 1198d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt void *user_data) 1199d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt{ 1200d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct group_changed_data *data = user_data; 1201d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct wpa_supplicant *wpa_s_go; 1202d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1203d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_s_go = wpas_get_p2p_client_iface(data->wpa_s, 1204d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt info->p2p_device_addr); 1205d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt if (wpa_s_go != NULL && wpa_s_go == data->wpa_s) { 1206d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpas_dbus_signal_peer_groups_changed(data->wpa_s->parent, 1207d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt info->p2p_device_addr); 1208d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt return; 1209d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt } 1210d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1211d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt data->info = info; 1212d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt p2p_loop_on_all_groups(data->wpa_s->global->p2p, 1213d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt match_group_where_peer_is_client, data); 1214d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt data->info = NULL; 1215d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt} 1216d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1217d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1218d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtstatic void peer_groups_changed(struct wpa_supplicant *wpa_s) 1219d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt{ 1220d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt struct group_changed_data data; 1221d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1222d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt os_memset(&data, 0, sizeof(data)); 1223d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt data.wpa_s = wpa_s; 1224d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1225d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt p2p_loop_on_known_peers(wpa_s->global->p2p, 1226d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt signal_peer_groups_changed, &data); 1227d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt} 1228d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1229d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 12308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 123175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_p2p_group_started - Signals P2P group has 12321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * started. Emitted when a group is successfully started 123375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * irrespective of the role (client/GO) of the current device 12348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 123575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 123675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ssid: SSID object 123775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @client: this device is P2P client 123875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @network_id: network id of the group started, use instead of ssid->id 123975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * to account for persistent groups 12408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 124175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s, 124275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_ssid *ssid, 124375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int client, int network_id) 12448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 124575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 124675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 124775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 124875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 124975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->parent->global->dbus; 125075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 125175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 125275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 125375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 125475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 125550b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt if (wpa_s->dbus_groupobj_path == NULL) 125675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 125775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 125875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* New interface has been created for this group */ 125975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->parent->dbus_new_path, 126075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 126175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "GroupStarted"); 126275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 126375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 126475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 126575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 126675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 126775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto nomem; 126875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 126975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* 127075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * In case the device supports creating a separate interface the 127175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * DBus client will need to know the object path for the interface 127275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * object this group was created on, so include it here. 127375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 127475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_append_object_path(&dict_iter, 127575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "interface_object", 127675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path)) 127775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto nomem; 127875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 127975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_append_string(&dict_iter, "role", 128075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen client ? "client" : "GO")) 128175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto nomem; 128275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 128375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_append_object_path(&dict_iter, "group_object", 128450b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt wpa_s->dbus_groupobj_path) || 128575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_close_write(&iter, &dict_iter)) 128675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto nomem; 128775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 128875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 128975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1290d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt if (client) 1291d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt peer_groups_changed(wpa_s); 1292d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 129375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinennomem: 129475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 12958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 12968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 12988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 12998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 130050b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt * Method to emit GONegotiation Success or Failure signals based 130175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * on status. 130275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @status: Status of the GO neg request. 0 for success, other for errors. 13038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 13041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtvoid wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s, 13051f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt struct p2p_go_neg_results *res) 13068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 130775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 13081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter, dict_iter; 13091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter_dict_entry, iter_dict_val, iter_dict_array; 131075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 13111f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 13121f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_int32_t freqs[P2P_MAX_CHANNELS]; 13131f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_int32_t *f_array = freqs; 13141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 131675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 13178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt os_memset(freqs, 0, sizeof(freqs)); 131975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 132075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 132175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 13228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 13241f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 13251f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpa_s->dbus_new_path, MAC2STR(res->peer_device_addr)); 13261f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt path = peer_obj_path; 13271f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 132875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 132975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 13301f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->status ? "GONegotiationFailure" : 13311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "GONegotiationSuccess"); 133275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 133375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 13348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 13351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt dbus_message_iter_init_append(msg, &iter); 13361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 13371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 13381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object", 13391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt path) || 13401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "status", res->status)) 13411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 13421f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13431f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!res->status) { 13441f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt int i = 0; 13451f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt int freq_list_num = 0; 13461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13471f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (res->role_go) { 13481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_append_byte_array( 13491f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &dict_iter, "passphrase", 13501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt (const char *) res->passphrase, 13511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt sizeof(res->passphrase))) 13521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 13531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt } 13541f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_append_string(&dict_iter, "role_go", 13561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->role_go ? "GO" : 13571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "client") || 13581f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_int32(&dict_iter, "frequency", 13591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->freq) || 13601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, "ssid", 13611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt (const char *) res->ssid, 13621f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->ssid_len) || 13631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, 13641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "peer_device_addr", 13651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt (const char *) 13661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->peer_device_addr, 13671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt ETH_ALEN) || 13681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_byte_array(&dict_iter, 13691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "peer_interface_addr", 13701f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt (const char *) 13711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->peer_interface_addr, 13721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt ETH_ALEN) || 13731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_string(&dict_iter, "wps_method", 13741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt p2p_wps_method_text( 13751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->wps_method))) 137675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 13771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt for (i = 0; i < P2P_MAX_CHANNELS; i++) { 13791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (res->freq_list[i]) { 13801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt freqs[i] = res->freq_list[i]; 13811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt freq_list_num++; 13821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt } 138375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 13841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_begin_array(&dict_iter, 13861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "frequency_list", 13871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBUS_TYPE_INT32_AS_STRING, 13881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_entry, 13891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_val, 13901f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_array)) 13911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 13921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!dbus_message_iter_append_fixed_array(&iter_dict_array, 13941f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBUS_TYPE_INT32, 13951f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &f_array, 13961f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt freq_list_num)) 13971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 13981f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 13991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_end_array(&dict_iter, 14001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_entry, 14011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_val, 14021f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt &iter_dict_array)) 14031f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 14041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 14051f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_append_int32(&dict_iter, "persistent_group", 14061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->persistent_group) || 14071f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt !wpa_dbus_dict_append_uint32(&dict_iter, 14081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt "peer_config_timeout", 14091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt res->peer_config_timeout)) 14101f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 141175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 14128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14131f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) 14141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt goto err; 14151f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt 141675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 141775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 141875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 14198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 14208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 14218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 142275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 142375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 142475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit Invitation Result signal based on status and 142575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * bssid 142675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @status: Status of the Invite request. 0 for success, other 142775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * for errors 142875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @bssid : Basic Service Set Identifier 142975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 143075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s, 143175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int status, const u8 *bssid) 143275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 143375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 143475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 143575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 143675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1437051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidt wpa_printf(MSG_DEBUG, "%s", __func__); 143875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 143975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 144075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 144175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 144275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 144375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 144475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 144575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 144675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "InvitationResult"); 144775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 144875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 144975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 145075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 145175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 145275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 145375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto nomem; 145475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 145575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_append_int32(&dict_iter, "status", status)) 145675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto nomem; 145775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (bssid) { 145875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_append_byte_array(&dict_iter, "BSSID", 145975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (const char *) bssid, 146075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ETH_ALEN)) 146175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto nomem; 146275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 146375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) 146475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto nomem; 146575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 146675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 146775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 146875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinennomem: 146975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 147075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 147175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 147275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 147375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 147475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 147575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit a signal for a peer joining the group. 147675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * The signal will carry path to the group member object 147775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * constructed using p2p i/f addr used for connecting. 147875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 147975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 1480d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * @peer_addr: P2P Device Address of the peer joining the group 148175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 148275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s, 1483d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt const u8 *peer_addr) 148475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 148575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 148675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 148775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 1488d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 148975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 149075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 149175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 149275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 149375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 149475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 149575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 149675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_s->dbus_groupobj_path) 149775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 149875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1499d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 1500d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 150175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, 1502d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_s->parent->dbus_new_path, MAC2STR(peer_addr)); 150375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 150475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path, 150575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2P_GROUP, 150675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "PeerJoined"); 150775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 150875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 150975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 151075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 1511d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt path = peer_obj_path; 151275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 151375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &path)) 151475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 151575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 151675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 151775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 1518d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1519d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpas_dbus_signal_peer_groups_changed(wpa_s->parent, peer_addr); 1520d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 152175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 152275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 152375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 152475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 152575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 152675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 152775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 152875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 152975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 153075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 153175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit a signal for a peer disconnecting the group. 153275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * The signal will carry path to the group member object 1533d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * constructed using the P2P Device Address of the peer. 153475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 153575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 1536d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt * @peer_addr: P2P Device Address of the peer joining the group 153775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 153875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s, 1539d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt const u8 *peer_addr) 154075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 154175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 154275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 154375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 1544d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 154575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 154675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 154775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 154875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 154975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 155075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 155175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 155275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_s->dbus_groupobj_path) 155375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 155475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 1555d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 1556d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 155775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, 1558d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_s->dbus_groupobj_path, MAC2STR(peer_addr)); 155975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 156075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path, 156175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2P_GROUP, 156275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "PeerDisconnected"); 156375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 156475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 156575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 156675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 1567d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt path = peer_obj_path; 156875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 156975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &path)) 157075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 157175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 157275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 157375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 1574d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 1575d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpas_dbus_signal_peer_groups_changed(wpa_s->parent, peer_addr); 1576d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 157775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 157875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 157975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 158075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct PeerDisconnected " 158175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "signal"); 158275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 158375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 158475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 158575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 158675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 158775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 158875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit a signal for a service discovery request. 158975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * The signal will carry station address, frequency, dialog token, 159075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * update indicator and it tlvs 159175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 159275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 159375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @sa: station addr (p2p i/f) of the peer 159475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dialog_token: service discovery request dialog token 159575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @update_indic: service discovery request update indicator 159675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @tlvs: service discovery request genrated byte array of tlvs 159775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @tlvs_len: service discovery request tlvs length 159875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 159975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s, 160075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int freq, const u8 *sa, u8 dialog_token, 160175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen u16 update_indic, const u8 *tlvs, 160275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen size_t tlvs_len) 160375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 160475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 160575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 160675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 160775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 160875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 160975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 161075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 161175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 161275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 161375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 161475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 161575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 161675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ServiceDiscoveryRequest"); 161775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 161875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 161975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 162075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Check if this is a known peer */ 16211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!p2p_peer_known(wpa_s->global->p2p, sa)) 162275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 162375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 162475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 162575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 162675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, wpa_s->dbus_new_path, MAC2STR(sa)); 162775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 162875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 162975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 163075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 163175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 163275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 163375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 163475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 163575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object", 163675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path) || 163775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_int32(&dict_iter, "frequency", freq) || 163875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_int32(&dict_iter, "dialog_token", 163975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dialog_token) || 164075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator", 164175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen update_indic) || 164275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_byte_array(&dict_iter, "tlvs", 164375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (const char *) tlvs, 164475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen tlvs_len) || 164575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_close_write(&iter, &dict_iter)) 164675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 164775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 164875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 164975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 165075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 165175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerror: 165275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 165375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 165475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 165575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 165675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 165775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 165875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 165975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Method to emit a signal for a service discovery response. 166075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * The signal will carry station address, update indicator and it 166175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * tlvs 166275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 166375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 166475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @sa: station addr (p2p i/f) of the peer 166575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @update_indic: service discovery request update indicator 166675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @tlvs: service discovery request genrated byte array of tlvs 166775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @tlvs_len: service discovery request tlvs length 166875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 166975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s, 167075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *sa, u16 update_indic, 167175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *tlvs, size_t tlvs_len) 167275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 167375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 167475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 167575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 167675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 167775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 167875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 167975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 168075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 168175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 168275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 168375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 168475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 168575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "ServiceDiscoveryResponse"); 168675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 168775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 168875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 168975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Check if this is a known peer */ 16901f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!p2p_peer_known(wpa_s->global->p2p, sa)) 169175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 169275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 169375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 169475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" 169575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen COMPACT_MACSTR, wpa_s->dbus_new_path, MAC2STR(sa)); 169675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 169775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 169875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 169975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 170075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) 170175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 170275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 170375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object", 170475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path) || 170575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator", 170675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen update_indic) || 170775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_byte_array(&dict_iter, "tlvs", 170875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (const char *) tlvs, 170975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen tlvs_len) || 171075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_close_write(&iter, &dict_iter)) 171175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto error; 171275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 171375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 171475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 171575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 171675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 171775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerror: 171875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 171975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 172075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 172175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 172275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 172375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_persistent_group - Send a persistent group related 172475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * event signal 172575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 172675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @id: new persistent group id 172775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @sig_name: signal name - PersistentGroupAdded, PersistentGroupRemoved 172875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @properties: determines if add second argument with object properties 172975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 173075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about an event related to persistent groups. 173175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 173275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_signal_persistent_group(struct wpa_supplicant *wpa_s, 173375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int id, const char *sig_name, 173475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int properties) 173575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 173675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 173775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 17381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt DBusMessageIter iter; 173975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 174075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 174175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 174275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 174375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 174475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 174575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 174675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 174775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 174875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u", 174975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, id); 175075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 175175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 175275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 175375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen sig_name); 175475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 175575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 175675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 175775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 175875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = pgrp_obj_path; 175975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 176075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &path)) 176175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 176275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 176375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (properties) { 17641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (!wpa_dbus_get_object_properties( 17651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt iface, pgrp_obj_path, 17661f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, &iter)) 176775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 176875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 176975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 177075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 177175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 177275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 177375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 177475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 177575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 177675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 177775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 177875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 177975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 178075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 178175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 178275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_persistent_group_added - Send a persistent_group 178375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * added signal 178475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 178575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @id: new persistent group id 178675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 178775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about addition of a new persistent group. 178875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 178975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_signal_persistent_group_added( 179075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_supplicant *wpa_s, int id) 179175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 179275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_persistent_group(wpa_s, id, "PersistentGroupAdded", 179375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen TRUE); 179475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 179575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 179675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 179775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 179875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_persistent_group_removed - Send a persistent_group 179975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * removed signal 180075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 180175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @id: persistent group id 180275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 180375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about removal of a persistent group. 180475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 180575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_signal_persistent_group_removed( 180675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_supplicant *wpa_s, int id) 180775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 180875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_persistent_group(wpa_s, id, "PersistentGroupRemoved", 180975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen FALSE); 181075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 181175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 181275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 181375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 181475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_p2p_wps_failed - Signals WpsFailed event 181575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 181675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 181775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends Event dbus signal with name "fail" and dictionary containing 181875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * "msg" field with fail message number (int32) as arguments 181975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 182075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s, 182175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wps_event_fail *fail) 182275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 182375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 182475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 182575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter, dict_iter; 182675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 182775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *key = "fail"; 182875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 182975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 183075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 183175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 183275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 183375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 183475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 183575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, 183675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 183775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "WpsFailed"); 183875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 183975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 184075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 184175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 184275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 184375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || 184475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_open_write(&iter, &dict_iter) || 184575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_int32(&dict_iter, "msg", fail->msg) || 184675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_append_int16(&dict_iter, "config_error", 184775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen fail->config_error) || 184875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen !wpa_dbus_dict_close_write(&iter, &dict_iter)) 184975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 185075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen else 185175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 185275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 185375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 185475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 185575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 185675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /*CONFIG_P2P*/ 185775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 185875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 185975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 186075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_prop_changed - Signals change of property 186175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 186275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @property: indicates which property has changed 186375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 186475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals with path, interface and arguments 186575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * depending on which property has changed. 186675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 186775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s, 186875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen enum wpas_dbus_prop property) 186975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 187075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *prop; 187104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt dbus_bool_t flush; 187275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 187375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_new_path == NULL) 187475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; /* Skip signal since D-Bus setup is not yet ready */ 187575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 187604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt flush = FALSE; 187775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen switch (property) { 187875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_AP_SCAN: 187975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "ApScan"; 188075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 188175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_SCANNING: 188275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Scanning"; 188375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 188475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_STATE: 188575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "State"; 188675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 188775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_CURRENT_BSS: 188875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "CurrentBSS"; 188975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 189075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_CURRENT_NETWORK: 189175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "CurrentNetwork"; 189275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 189375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_BSSS: 189475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "BSSs"; 189575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 189675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_PROP_CURRENT_AUTH_MODE: 189775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "CurrentAuthMode"; 189875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 189904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt case WPAS_DBUS_PROP_DISCONNECT_REASON: 190004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt prop = "DisconnectReason"; 190104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt flush = TRUE; 190204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt break; 190375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen default: 190475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d", 190575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__, property); 190675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 190775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 190875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 190975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(wpa_s->global->dbus, 191075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, 191175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_INTERFACE, prop); 191204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (flush) { 191304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_dbus_flush_object_changed_properties( 191404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_s->global->dbus->con, wpa_s->dbus_new_path); 191504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 191675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 191775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 191875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 191975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 192075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_bss_signal_prop_changed - Signals change of BSS property 192175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 192275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @property: indicates which property has changed 192375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @id: unique BSS identifier 192475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 192575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals with path, interface, and arguments depending 192675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * on which property has changed. 192775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 192875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s, 192975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen enum wpas_dbus_bss_prop property, 193075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen unsigned int id) 193175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 193275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char path[WPAS_DBUS_OBJECT_PATH_MAX]; 193375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char *prop; 193475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 193575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen switch (property) { 193675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_SIGNAL: 193775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Signal"; 193875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 193975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_FREQ: 194075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Frequency"; 194175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 194275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_MODE: 194375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Mode"; 194475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 194575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_PRIVACY: 194675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Privacy"; 194775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 194875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_RATES: 194975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "Rates"; 195075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 195175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_WPA: 195275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "WPA"; 195375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 195475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_RSN: 195575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "RSN"; 195675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 1957f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt case WPAS_DBUS_BSS_PROP_WPS: 1958f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt prop = "WPS"; 1959f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt break; 196075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen case WPAS_DBUS_BSS_PROP_IES: 196175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen prop = "IEs"; 196275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen break; 196375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen default: 196475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d", 196575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__, property); 196675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 196775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 196875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 196975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX, 197075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u", 197175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, id); 197275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 197375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(wpa_s->global->dbus, path, 197475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_BSS, prop); 197575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 197675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 197775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 197875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 197975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_debug_level_changed - Signals change of debug param 198075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @global: wpa_global structure 198175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 198275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals informing that debug level has changed. 198375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 198475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_debug_level_changed(struct wpa_global *global) 198575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 198675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH, 198775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_INTERFACE, 198875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "DebugLevel"); 198975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 199075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 199175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 199275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 199375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_debug_timestamp_changed - Signals change of debug param 199475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @global: wpa_global structure 199575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 199675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals informing that debug timestamp has changed. 199775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 199875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global) 199975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 200075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH, 200175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_INTERFACE, 200275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "DebugTimestamp"); 200375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 200475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 200575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 200675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 200775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_debug_show_keys_changed - Signals change of debug param 200875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @global: wpa_global structure 200975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 201075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Sends PropertyChanged signals informing that debug show_keys has changed. 201175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 201275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global) 201375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 201475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH, 201575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_INTERFACE, 201675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "DebugShowKeys"); 201775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 201875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 201975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 202075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_register(struct wpa_dbus_object_desc *obj_desc, 202175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen void *priv, 202275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPADBusArgumentFreeFunction priv_free, 202375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_dbus_method_desc *methods, 202475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_dbus_property_desc *properties, 202575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_dbus_signal_desc *signals) 202675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 202775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int n; 202875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 202975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->user_data = priv; 203075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->user_data_free_func = priv_free; 203175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->methods = methods; 203275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->properties = properties; 203375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->signals = signals; 203475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 203575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen for (n = 0; properties && properties->dbus_property; properties++) 203675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen n++; 203775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 203875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc->prop_changed_flags = os_zalloc(n); 203975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc->prop_changed_flags) 204075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: %s: can't register handlers", 204175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__); 204275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 204375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 204475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 204575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_method_desc wpas_dbus_global_methods[] = { 20468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "CreateInterface", WPAS_DBUS_NEW_INTERFACE, 20478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_create_interface, 20488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 20498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 20508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 20518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 20528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 20538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 20548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RemoveInterface", WPAS_DBUS_NEW_INTERFACE, 20558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_remove_interface, 20568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 20578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_IN }, 20588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 20598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 20608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 20618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "GetInterface", WPAS_DBUS_NEW_INTERFACE, 20628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_get_interface, 20638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 20648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "ifname", "s", ARG_IN }, 20658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 20668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 20678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 20688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 20698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, NULL, { END_ARGS } } 20708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 20718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 20728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_property_desc wpas_dbus_global_properties[] = { 20738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "DebugLevel", WPAS_DBUS_NEW_INTERFACE, "s", 20741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_debug_level, 20751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_debug_level 20768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 20778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "DebugTimestamp", WPAS_DBUS_NEW_INTERFACE, "b", 20781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_debug_timestamp, 20791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_debug_timestamp 20808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 20818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "DebugShowKeys", WPAS_DBUS_NEW_INTERFACE, "b", 20821f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_debug_show_keys, 20831f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_debug_show_keys 20848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 20858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Interfaces", WPAS_DBUS_NEW_INTERFACE, "ao", 20861f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_interfaces, 20871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 20888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 20898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "EapMethods", WPAS_DBUS_NEW_INTERFACE, "as", 20901f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_eap_methods, 20911f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 20928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2093d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt { "Capabilities", WPAS_DBUS_NEW_INTERFACE, "as", 2094d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt wpas_dbus_getter_global_capabilities, 2095d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt NULL 2096d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt }, 20971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { NULL, NULL, NULL, NULL, NULL } 20988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 20998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_signal_desc wpas_dbus_global_signals[] = { 21018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "InterfaceAdded", WPAS_DBUS_NEW_INTERFACE, 21028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 21038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 21048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 21058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 21068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 21078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 21088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "InterfaceRemoved", WPAS_DBUS_NEW_INTERFACE, 21098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 21108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 21118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 21128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 21138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 21141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "NetworkRequest", WPAS_DBUS_NEW_IFACE_INTERFACE, 21151f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { 21161f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "path", "o", ARG_OUT }, 21171f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "field", "s", ARG_OUT }, 21181f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "text", "s", ARG_OUT }, 21191f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt END_ARGS 21201f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt } 21211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt }, 21221f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 21238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "PropertiesChanged", WPAS_DBUS_NEW_INTERFACE, 21248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 21258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 21268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 21278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 21288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 21298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, { END_ARGS } } 21308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 21318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 21348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_ctrl_iface_init - Initialize dbus control interface 21358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @global: Pointer to global data from wpa_supplicant_init() 21368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success or -1 on failure 21378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 21388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Initialize the dbus control interface for wpa_supplicantand and start 21398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * receiving commands from external programs over the bus. 21408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 21418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv) 21428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 21438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_dbus_object_desc *obj_desc; 21448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int ret; 21458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 21478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!obj_desc) { 21488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "Not enough memory " 21498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "to create object description"); 21508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 21518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 21528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_register(obj_desc, priv->global, NULL, 21548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_global_methods, 21558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_global_properties, 21568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_global_signals); 21578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Register D-Bus object '%s'", 21598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_PATH); 21608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ret = wpa_dbus_ctrl_iface_init(priv, WPAS_DBUS_NEW_PATH, 21618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_SERVICE, 21628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt obj_desc); 21638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ret < 0) 21648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt free_dbus_object_desc(obj_desc); 21658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 21668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt priv->dbus_new_initialized = 1; 21678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return ret; 21698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 21708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 21738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_ctrl_iface_deinit - Deinitialize dbus ctrl interface for 21748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_supplicant 21758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @iface: Pointer to dbus private data from wpas_dbus_init() 21768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 21778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Deinitialize the dbus control interface that was initialized with 21788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_ctrl_iface_init(). 21798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 21808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface) 21818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 21828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!iface->dbus_new_initialized) 21838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 21848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Unregister D-Bus object '%s'", 21858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_PATH); 21868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt dbus_connection_unregister_object_path(iface->con, 21878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt WPAS_DBUS_NEW_PATH); 21888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 21898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpa_dbus_free(void *ptr) 21928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 21938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_free(ptr); 21948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 21958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 21978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_property_desc wpas_dbus_network_properties[] = { 21988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Properties", WPAS_DBUS_NEW_IFACE_NETWORK, "a{sv}", 21991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_network_properties, 22001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_network_properties 22018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Enabled", WPAS_DBUS_NEW_IFACE_NETWORK, "b", 22031f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_enabled, 22041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_enabled 22058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22061f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { NULL, NULL, NULL, NULL, NULL } 22078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 22088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_signal_desc wpas_dbus_network_signals[] = { 22111f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 22128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_NETWORK, 22138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 22148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 22158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 22168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 22178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 22188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, { END_ARGS } } 22198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 22208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 22238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_register_network - Register a configured network with dbus 22248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: wpa_supplicant interface structure 22258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ssid: network configuration data 22268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 22278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 22288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Registers network representing object with dbus 22298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 22308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_register_network(struct wpa_supplicant *wpa_s, 22318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_ssid *ssid) 22328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 22338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 22348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_dbus_object_desc *obj_desc; 22358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct network_handler_args *arg; 22368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 22378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 2238c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt#ifdef CONFIG_P2P 223975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* 224075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * If it is a persistent group register it as such. 224175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This is to handle cases where an interface is being initialized 224275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * with a list of networks read from config. 224375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 224475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (network_is_persistent_group(ssid)) 224575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return wpas_dbus_register_persistent_group(wpa_s, ssid); 2246c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt#endif /* CONFIG_P2P */ 224775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 22488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 22498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_s == NULL || wpa_s->global == NULL) 22508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 22518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 22528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 22538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 22548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 22568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", 22578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, ssid->id); 22588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Register network object '%s'", 22608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt net_obj_path); 22618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 22628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!obj_desc) { 22638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "Not enough memory " 22648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "to create object description"); 22658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 22668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 22678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* allocate memory for handlers arguments */ 22698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg = os_zalloc(sizeof(struct network_handler_args)); 22708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!arg) { 22718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "Not enough memory " 22728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "to create arguments for method"); 22738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 22748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 22758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg->wpa_s = wpa_s; 22778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg->ssid = ssid; 22788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL, 22808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_network_properties, 22818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_network_signals); 22828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_dbus_register_object_per_iface(ctrl_iface, net_obj_path, 22848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->ifname, obj_desc)) 22858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 22868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network_added(wpa_s, ssid->id); 22888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 22908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 22928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt free_dbus_object_desc(obj_desc); 22938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 22948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 22958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 22978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 22988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_unregister_network - Unregister a configured network from dbus 22998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: wpa_supplicant interface structure 23008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @nid: network id 23018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 23028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 23038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Unregisters network representing object from dbus 23048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 23058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid) 23068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 23078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 23088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 23098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt int ret; 231004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_P2P 231175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_ssid *ssid; 231275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 231375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ssid = wpa_config_get_network(wpa_s->conf, nid); 231475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 231575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* If it is a persistent group unregister it as such */ 231675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ssid && network_is_persistent_group(ssid)) 231775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return wpas_dbus_unregister_persistent_group(wpa_s, nid); 2318c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt#endif /* CONFIG_P2P */ 23198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 23211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt if (wpa_s->global == NULL || wpa_s->dbus_new_path == NULL) 23228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 23238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 23248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 23258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 23268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 23288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", 23298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, nid); 23308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Unregister network object '%s'", 23328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt net_obj_path); 23338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, net_obj_path); 23348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!ret) 23368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_network_removed(wpa_s, nid); 23378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return ret; 23398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 23408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_property_desc wpas_dbus_bss_properties[] = { 23438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "SSID", WPAS_DBUS_NEW_IFACE_BSS, "ay", 23441f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_ssid, 23451f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "BSSID", WPAS_DBUS_NEW_IFACE_BSS, "ay", 23481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_bssid, 23491f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Privacy", WPAS_DBUS_NEW_IFACE_BSS, "b", 23521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_privacy, 23531f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Mode", WPAS_DBUS_NEW_IFACE_BSS, "s", 23561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_mode, 23571f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Signal", WPAS_DBUS_NEW_IFACE_BSS, "n", 23601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_signal, 23611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Frequency", WPAS_DBUS_NEW_IFACE_BSS, "q", 23641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_frequency, 23651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Rates", WPAS_DBUS_NEW_IFACE_BSS, "au", 23681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_rates, 23691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "WPA", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}", 23721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_wpa, 23731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RSN", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}", 23761f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_rsn, 23771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2379d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt { "WPS", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}", 2380d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt wpas_dbus_getter_bss_wps, 2381d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt NULL 2382d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt }, 23838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "IEs", WPAS_DBUS_NEW_IFACE_BSS, "ay", 23841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_ies, 23851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 23868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23871f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { NULL, NULL, NULL, NULL, NULL } 23888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 23898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 23918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_signal_desc wpas_dbus_bss_signals[] = { 23921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 23938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_BSS, 23948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 23958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 23968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 23978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 23988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 23998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, { END_ARGS } } 24008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 24018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 24048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_unregister_bss - Unregister a scanned BSS from dbus 24058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: wpa_supplicant interface structure 24068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: scanned network bssid 24078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: unique BSS identifier 24088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 24098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 24108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Unregisters BSS representing object from dbus 24118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 24128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s, 24138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 bssid[ETH_ALEN], unsigned int id) 24148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 24158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 24168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 24178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 24198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_s == NULL || wpa_s->global == NULL) 24208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 24218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 24228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 24238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 24248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 24268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u", 24278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, id); 24288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Unregister BSS object '%s'", 24308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt bss_obj_path); 24318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_dbus_unregister_object_per_iface(ctrl_iface, bss_obj_path)) { 24328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "dbus: Cannot unregister BSS object %s", 24338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt bss_obj_path); 24348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 24358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 24368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_bss_removed(wpa_s, bss_obj_path); 24388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSSS); 24398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 24418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 24428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** 24458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpas_dbus_register_bss - Register a scanned BSS with dbus 24468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @wpa_s: wpa_supplicant interface structure 24478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @bssid: scanned network bssid 24488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @id: unique BSS identifier 24498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure 24508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * 24518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Registers BSS representing object with dbus 24528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */ 24538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_dbus_register_bss(struct wpa_supplicant *wpa_s, 24548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt u8 bssid[ETH_ALEN], unsigned int id) 24558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 24568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 24578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpa_dbus_object_desc *obj_desc; 24588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 24598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct bss_handler_args *arg; 24608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 24628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_s == NULL || wpa_s->global == NULL) 24638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 24648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 24658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 24668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 24678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 24698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u", 24708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->dbus_new_path, id); 24718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 24738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!obj_desc) { 24748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "Not enough memory " 24758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "to create object description"); 24768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 24778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 24788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg = os_zalloc(sizeof(struct bss_handler_args)); 24808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!arg) { 24818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, "Not enough memory " 24828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "to create arguments for handler"); 24838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 24848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 24858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg->wpa_s = wpa_s; 24868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt arg->id = id; 24878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL, 24898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_bss_properties, 24908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_bss_signals); 24918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 24928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_DEBUG, "dbus: Register BSS object '%s'", 24938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt bss_obj_path); 24948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (wpa_dbus_register_object_per_iface(ctrl_iface, bss_obj_path, 24958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_s->ifname, obj_desc)) { 24968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpa_printf(MSG_ERROR, 24978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt "Cannot register BSSID dbus object %s.", 24988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt bss_obj_path); 24998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt goto err; 25008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_bss_added(wpa_s, bss_obj_path); 25038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSSS); 25048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 25068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 25088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt free_dbus_object_desc(obj_desc); 25098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 25108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 25118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 25138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = { 25148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Scan", WPAS_DBUS_NEW_IFACE_INTERFACE, 25158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_scan, 25168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 25188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Disconnect", WPAS_DBUS_NEW_IFACE_INTERFACE, 25228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_disconnect, 25238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "AddNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, 25288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_add_network, 25298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 25318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 25328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 253561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt { "Reassociate", WPAS_DBUS_NEW_IFACE_INTERFACE, 253661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_reassociate, 253761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt { 253861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt END_ARGS 253961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt } 254061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt }, 25419866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt { "Reattach", WPAS_DBUS_NEW_IFACE_INTERFACE, 25429866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_reattach, 25439866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt { 25449866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt END_ARGS 25459866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt } 25469866086a955d00e237cc8df3722e7dff75c02532Dmitry Shmidt }, 25478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RemoveNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, 25488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_remove_network, 25498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_IN }, 25518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RemoveAllNetworks", WPAS_DBUS_NEW_IFACE_INTERFACE, 25558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_remove_all_networks, 25568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "SelectNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, 25618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_select_network, 25628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_IN }, 25648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "NetworkReply", WPAS_DBUS_NEW_IFACE_INTERFACE, 25681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_network_reply, 25691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { 25701f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "path", "o", ARG_IN }, 25711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "field", "s", ARG_IN }, 25721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "value", "s", ARG_IN }, 25731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt END_ARGS 25741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt } 25751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt }, 2576700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt#ifndef CONFIG_NO_CONFIG_BLOBS 25778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "AddBlob", WPAS_DBUS_NEW_IFACE_INTERFACE, 25788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_add_blob, 25798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "name", "s", ARG_IN }, 25818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "data", "ay", ARG_IN }, 25828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "GetBlob", WPAS_DBUS_NEW_IFACE_INTERFACE, 25868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_get_blob, 25878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "name", "s", ARG_IN }, 25898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "data", "ay", ARG_OUT }, 25908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 25938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "RemoveBlob", WPAS_DBUS_NEW_IFACE_INTERFACE, 25948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_remove_blob, 25958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 25968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "name", "s", ARG_IN }, 25978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 25988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 25998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 2600700a137ab366edc72e371da68ba187b4717ee660Dmitry Shmidt#endif /* CONFIG_NO_CONFIG_BLOBS */ 260101904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "SetPKCS11EngineAndModulePath", WPAS_DBUS_NEW_IFACE_INTERFACE, 260201904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt (WPADBusMethodHandler) 260301904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt &wpas_dbus_handler_set_pkcs11_engine_and_module_path, 260401904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { 260501904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "pkcs11_engine_path", "s", ARG_IN }, 260601904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "pkcs11_module_path", "s", ARG_IN }, 260701904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt END_ARGS 260801904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt } 260901904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt }, 26108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS 26118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Start", WPAS_DBUS_NEW_IFACE_WPS, 26128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_wps_start, 26138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 26148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "args", "a{sv}", ARG_IN }, 26158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "output", "a{sv}", ARG_OUT }, 26168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 26178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 26188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 26198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */ 262075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 262175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Find", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 262275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_find, 262375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 262475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 262575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 262675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 262775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 262875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "StopFind", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 262975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_stop_find, 263075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 263175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 263275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 263375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 263475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Listen", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 263575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_listen, 263675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 263775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "timeout", "i", ARG_IN }, 263875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 263975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 264075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 264175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ExtendedListen", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 264275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_extendedlisten, 264375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 264475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 264575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 264675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 264775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 264875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PresenceRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 264975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_presence_request, 265075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 265175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 265275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 265375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 265475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 265575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 265675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_prov_disc_req, 265775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 265875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer", "o", ARG_IN }, 265975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "config_method", "s", ARG_IN }, 266075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 266175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 266275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 266375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Connect", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 266475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_connect, 266575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 266675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 26671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { "generated_pin", "s", ARG_OUT }, 266875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 266975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 267075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 267175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GroupAdd", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 267275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_group_add, 267375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 267475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 267575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 267675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 267775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 267875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Invite", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 267975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_invite, 268075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 268175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 268275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 268375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 268475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 268575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Disconnect", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 268675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_disconnect, 268775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 268875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 268975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 269075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 269175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "RejectPeer", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 269275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_rejectpeer, 269375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 269475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer", "o", ARG_IN }, 269575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 269675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 269775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 269875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Flush", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 269975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_flush, 270075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 270175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 270275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 270375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 270475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "AddService", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 270575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_add_service, 270675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 270775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 270875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 270975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 271075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 271175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "DeleteService", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 271275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_delete_service, 271375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 271475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 271575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 271675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 271775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 271875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "FlushService", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 271975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_flush_service, 272075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 272175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 272275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 272375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 272475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 272575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_service_sd_req, 272675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 272775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 2728d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt { "ref", "t", ARG_OUT }, 272975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 273075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 273175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 273275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 273375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_service_sd_res, 273475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 273575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 273675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 273775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 273875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 273975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryCancelRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 274075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_service_sd_cancel_req, 274175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 274275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "t", ARG_IN }, 274375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 274475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 274575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 274675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceUpdate", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 274775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_service_update, 274875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 274975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 275075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 275175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 275275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryExternal", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 275375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler)wpas_dbus_handler_p2p_serv_disc_external, 275475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 275575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "arg", "i", ARG_IN }, 275675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 275775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 275875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 275975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "AddPersistentGroup", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 276075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler) wpas_dbus_handler_add_persistent_group, 276175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 276275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_IN }, 276375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 276475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 276575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 276675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 276775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "RemovePersistentGroup", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 276875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler) wpas_dbus_handler_remove_persistent_group, 276975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 277075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_IN }, 277175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 277275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 277375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 277475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "RemoveAllPersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 277575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen (WPADBusMethodHandler) 277675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_handler_remove_all_persistent_groups, 277775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 277875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 277975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 278075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 278175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */ 27828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "FlushBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, 27838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_flush_bss, 27848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 27858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "age", "u", ARG_IN }, 27868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 27878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 27888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 278904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_AP 279004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "SubscribeProbeReq", WPAS_DBUS_NEW_IFACE_INTERFACE, 279104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_subscribe_preq, 279204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 279304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt END_ARGS 279404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 279504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 279604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "UnsubscribeProbeReq", WPAS_DBUS_NEW_IFACE_INTERFACE, 279704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_unsubscribe_preq, 279804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 279904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt END_ARGS 280004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 280104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 280204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_AP */ 28038da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt { "EAPLogoff", WPAS_DBUS_NEW_IFACE_INTERFACE, 28048da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_eap_logoff, 28058da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt { 28068da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt END_ARGS 28078da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt } 28088da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt }, 28098da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt { "EAPLogon", WPAS_DBUS_NEW_IFACE_INTERFACE, 28108da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_eap_logon, 28118da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt { 28128da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt END_ARGS 28138da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt } 28148da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt }, 281534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt#ifdef CONFIG_AUTOSCAN 281634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "AutoScan", WPAS_DBUS_NEW_IFACE_INTERFACE, 281734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt (WPADBusMethodHandler) &wpas_dbus_handler_autoscan, 281834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { 281934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "arg", "s", ARG_IN }, 282034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt END_ARGS 282134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt } 282234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt }, 282334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt#endif /* CONFIG_AUTOSCAN */ 2824e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt#ifdef CONFIG_TDLS 2825e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "TDLSDiscover", WPAS_DBUS_NEW_IFACE_INTERFACE, 2826e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_tdls_discover, 2827e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { 2828e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "peer_address", "s", ARG_IN }, 2829e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt END_ARGS 2830e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt } 2831e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt }, 2832e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "TDLSSetup", WPAS_DBUS_NEW_IFACE_INTERFACE, 2833e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_tdls_setup, 2834e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { 2835e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "peer_address", "s", ARG_IN }, 2836e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt END_ARGS 2837e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt } 2838e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt }, 2839e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "TDLSStatus", WPAS_DBUS_NEW_IFACE_INTERFACE, 2840e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_tdls_status, 2841e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { 2842e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "peer_address", "s", ARG_IN }, 2843e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "status", "s", ARG_OUT }, 2844e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt END_ARGS 2845e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt } 2846e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt }, 2847e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "TDLSTeardown", WPAS_DBUS_NEW_IFACE_INTERFACE, 2848e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt (WPADBusMethodHandler) wpas_dbus_handler_tdls_teardown, 2849e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { 2850e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt { "peer_address", "s", ARG_IN }, 2851e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt END_ARGS 2852e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt } 2853e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt }, 2854e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt#endif /* CONFIG_TDLS */ 28558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, NULL, { END_ARGS } } 28568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 28578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 28588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = { 28598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Capabilities", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{sv}", 28601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_capabilities, 28611f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 28628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "State", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 28641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_state, 28651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 28668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Scanning", WPAS_DBUS_NEW_IFACE_INTERFACE, "b", 28681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_scanning, 28691f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 28708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "ApScan", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", 28721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_ap_scan, 28731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_ap_scan 28748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "BSSExpireAge", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", 28761f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_expire_age, 28771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_bss_expire_age 28788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "BSSExpireCount", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", 28801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bss_expire_count, 28811f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_bss_expire_count 28828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Country", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 28841f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_country, 28851f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_country 28868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Ifname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 28881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_ifname, 28891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 28908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "Driver", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 28921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_driver, 28931f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 28948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "BridgeIfname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 28961f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bridge_ifname, 28971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 28988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 28998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "CurrentBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o", 29001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_current_bss, 29011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 29028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 290375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "CurrentNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, "o", 29041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_current_network, 29051f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 290675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 290775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "CurrentAuthMode", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 29081f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_current_auth_mode, 29091f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 291075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 291175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Blobs", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{say}", 29121f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_blobs, 29131f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 291475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 291575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BSSs", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao", 29161f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_bsss, 29171f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 291875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 291975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Networks", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao", 29201f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_networks, 29211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 292275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 2923c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "FastReauth", WPAS_DBUS_NEW_IFACE_INTERFACE, "b", 2924c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_fast_reauth, 2925c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_setter_fast_reauth 2926c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 292704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "ScanInterval", WPAS_DBUS_NEW_IFACE_INTERFACE, "i", 292804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_scan_interval, 292904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_setter_scan_interval 293004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 293101904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "PKCS11EnginePath", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 293201904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt wpas_dbus_getter_pkcs11_engine_path, 293301904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt NULL 293401904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt }, 293501904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt { "PKCS11ModulePath", WPAS_DBUS_NEW_IFACE_INTERFACE, "s", 293601904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt wpas_dbus_getter_pkcs11_module_path, 293701904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt NULL 293801904cfafd75a70b9f29c0220b90bdef45595491Dmitry Shmidt }, 293975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_WPS 294075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b", 29411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_process_credentials, 29421f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_process_credentials 294375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 294475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_WPS */ 294575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 294604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}", 294704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_device_config, 294804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_setter_p2p_device_config 294975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 295075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Peers", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao", 29511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_peers, 29521f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 295375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 295475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Role", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "s", 29551f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_role, 29561f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 295775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 295875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Group", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o", 29591f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_group, 29601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 296175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 296275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PeerGO", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o", 29631f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_peergo, 29641f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 296575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 296675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao", 29671f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_persistent_groups, 29681f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 296975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 297075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */ 297104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "DisconnectReason", WPAS_DBUS_NEW_IFACE_INTERFACE, "i", 297204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_disconnect_reason, 297304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 297404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 29751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { NULL, NULL, NULL, NULL, NULL } 297675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 297775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 297875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = { 297975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ScanDone", WPAS_DBUS_NEW_IFACE_INTERFACE, 298075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 298175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "success", "b", ARG_OUT }, 298275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 298375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 298475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 298575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BSSAdded", WPAS_DBUS_NEW_IFACE_INTERFACE, 298675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 298775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 298875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 298975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 299075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 299175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 299275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BSSRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE, 299375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 299475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 299575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 299675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 299775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 299875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BlobAdded", WPAS_DBUS_NEW_IFACE_INTERFACE, 299975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 300075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "name", "s", ARG_OUT }, 300175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 300275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 300375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 300475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "BlobRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE, 300575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 300675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "name", "s", ARG_OUT }, 300775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 300875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 300975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 301075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "NetworkAdded", WPAS_DBUS_NEW_IFACE_INTERFACE, 301175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 301275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 301375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 301475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 301575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 301675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 301775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "NetworkRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE, 301875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 301975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 302075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 302175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 302275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 302375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "NetworkSelected", WPAS_DBUS_NEW_IFACE_INTERFACE, 302475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 302575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 302675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 302775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 302875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 30291f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 303075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_INTERFACE, 303175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 303275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 303375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 303475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 303575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 303675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_WPS 303775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Event", WPAS_DBUS_NEW_IFACE_WPS, 303875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 303975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "name", "s", ARG_OUT }, 304075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_OUT }, 304175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 304275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 304375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 304475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Credentials", WPAS_DBUS_NEW_IFACE_WPS, 304575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 304675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "credentials", "a{sv}", ARG_OUT }, 304775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 304875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 304975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 30501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 305175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_WPS, 305275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 305375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 305475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 305575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 305675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 305775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_WPS */ 305875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 305975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "P2PStateChanged", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 306075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 306175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "states", "a{ss}", ARG_OUT }, 306275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 306375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 306475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 306575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "DeviceFound", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 306675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 306775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 306875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 306975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 307075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 307175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "DeviceLost", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 307275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 307375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "path", "o", ARG_OUT }, 307475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 307575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 307675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 307775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryRequestDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 307875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 307975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 308075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "pin", "s", ARG_OUT }, 308175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 308275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 30838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 308475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryResponseDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 308575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 308675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 308775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "pin", "s", ARG_OUT }, 308875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 308975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 30908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 309175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryRequestEnterPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 309275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 309375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 309475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 309575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 30968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 309775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryResponseEnterPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 309875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 309975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 310075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 310175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 31028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 310375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryPBCRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 310475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 310575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 310675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 310775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 31088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 310975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryPBCResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 311075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 311175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 311275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 311375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 31148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 311575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ProvisionDiscoveryFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 311775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer_object", "o", ARG_OUT }, 311875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "status", "i", ARG_OUT }, 31198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 312275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GroupStarted", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 31248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 31258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 312875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GONegotiationSuccess", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 312975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 313050b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 313175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 313275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 313375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 313475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GONegotiationFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 313575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { 313650b691dc36a8075e8f594e8bea93cb524fa6b1d2Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 313775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen END_ARGS 313875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 313975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 314075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GONegotiationRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 31428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 314375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "dev_passwd_id", "i", ARG_OUT }, 31448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 314775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "InvitationResult", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 314975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "invite_result", "a{sv}", ARG_OUT }, 31508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 315375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "GroupFinished", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 315503658834c33748b9ad86f3d4cdf0c7be9c6887d1Dmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 31568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 315975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 316175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "sd_request", "a{sv}", ARG_OUT }, 31628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 316575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "ServiceDiscoveryResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 316775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "sd_response", "a{sv}", ARG_OUT }, 31688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 317175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PersistentGroupAdded", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 31738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { "path", "o", ARG_OUT }, 317475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "properties", "a{sv}", ARG_OUT }, 31758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 3178c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { "PersistentGroupRemoved", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 3179c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { 3180c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { "path", "o", ARG_OUT }, 3181c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt END_ARGS 3182c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt } 3183c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt }, 318475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "WpsFailed", WPAS_DBUS_NEW_IFACE_P2PDEVICE, 31858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 318675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "name", "s", ARG_OUT }, 318775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "args", "a{sv}", ARG_OUT }, 31888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 31898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 31908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 319175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */ 319204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_AP 319304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "ProbeRequest", WPAS_DBUS_NEW_IFACE_INTERFACE, 319404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 319504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "args", "a{sv}", ARG_OUT }, 319604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt END_ARGS 319704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 319804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 319904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_AP */ 3200c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { "Certification", WPAS_DBUS_NEW_IFACE_INTERFACE, 3201c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { 3202c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt { "certification", "a{sv}", ARG_OUT }, 3203c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt END_ARGS 3204c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt } 3205c55524ad84d13014e8019491c2b17e5dcf13545aDmitry Shmidt }, 320604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "EAP", WPAS_DBUS_NEW_IFACE_INTERFACE, 320704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { 320804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "status", "s", ARG_OUT }, 320904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "parameter", "s", ARG_OUT }, 321004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt END_ARGS 321104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 321204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 321334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "StaAuthorized", WPAS_DBUS_NEW_IFACE_INTERFACE, 321434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { 321534af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "name", "s", ARG_OUT }, 321634af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt END_ARGS 321734af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt } 321834af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt }, 321934af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "StaDeauthorized", WPAS_DBUS_NEW_IFACE_INTERFACE, 322034af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { 322134af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt { "name", "s", ARG_OUT }, 322234af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt END_ARGS 322334af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt } 322434af306c42b7ccf956508e7cd23f0ba90606e360Dmitry Shmidt }, 322575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { NULL, NULL, { END_ARGS } } 322675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 322775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 322875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 322975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_register_interface(struct wpa_supplicant *wpa_s) 323075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 323175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 323275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_dbus_object_desc *obj_desc = NULL; 323375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface = wpa_s->global->dbus; 323475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int next; 323575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 323675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 323775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 323875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 323975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 324075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Create and set the interface's object path */ 324175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX); 324275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_new_path == NULL) 324375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 324475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen next = ctrl_iface->next_objid++; 324575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(wpa_s->dbus_new_path, WPAS_DBUS_OBJECT_PATH_MAX, 324675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_PATH_INTERFACES "/%u", 324775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen next); 324875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 324975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 325075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc) { 325175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "Not enough memory " 325275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "to create object description"); 325375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 325475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 325575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 325675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_register(obj_desc, wpa_s, NULL, wpas_dbus_interface_methods, 325775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_interface_properties, 325875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_interface_signals); 325975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 326075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Register interface object '%s'", 326175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path); 326275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_register_object_per_iface(ctrl_iface, 326375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, 326475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->ifname, obj_desc)) 326575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 326675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 326775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_interface_added(wpa_s); 326875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 326975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 327075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 327175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 327275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_free(wpa_s->dbus_new_path); 327375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path = NULL; 327475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen free_dbus_object_desc(obj_desc); 327575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 327675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 327775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 327875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 327975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s) 328075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 328175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 328275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 328375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 328475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 328575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 328675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 328775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 328875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 328975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 329075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Unregister interface object '%s'", 329175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path); 329204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 329304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_AP 329404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt if (wpa_s->preq_notify_peer) { 329504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_unsubscribe_noc(ctrl_iface); 329604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt os_free(wpa_s->preq_notify_peer); 329704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpa_s->preq_notify_peer = NULL; 329804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt } 329904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_AP */ 330004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt 330175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_unregister_object_per_iface(ctrl_iface, 330275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path)) 330375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 330475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 330575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_interface_removed(wpa_s); 330675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 330775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_free(wpa_s->dbus_new_path); 330875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path = NULL; 330975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 331075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 331175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 331275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 331375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P 331475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 331575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = { 3316c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "DeviceName", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s", 3317c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_device_name, 3318c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3319c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3320c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "PrimaryDeviceType", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay", 3321c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_primary_device_type, 3322c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3323c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3324c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "config_method", WPAS_DBUS_NEW_IFACE_P2P_PEER, "q", 3325c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_config_method, 3326c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3327c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3328c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "level", WPAS_DBUS_NEW_IFACE_P2P_PEER, "i", 3329c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_level, 3330c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3331c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3332c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "devicecapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y", 3333c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_device_capability, 3334c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3335c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 3336c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt { "groupcapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y", 3337c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_group_capability, 3338c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3339c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 334004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "SecondaryDeviceTypes", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay", 3341c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_secondary_device_types, 3342c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt NULL 3343c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt }, 334404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "VendorExtension", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay", 3345c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt wpas_dbus_getter_p2p_peer_vendor_extension, 33461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 334775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 334875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "IEs", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay", 33491f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_peer_ies, 33501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 335175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 3352d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt { "DeviceAddress", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay", 3353d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt wpas_dbus_getter_p2p_peer_device_address, 3354d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt NULL 3355d11f019d62a42a8fc4c4d1f2ec17cf35b0763153Dmitry Shmidt }, 3356d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt { "Groups", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ao", 3357d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpas_dbus_getter_p2p_peer_groups, 3358d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt NULL 3359d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt }, 33601f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { NULL, NULL, NULL, NULL, NULL } 336175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 336275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 336375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_signal_desc wpas_dbus_p2p_peer_signals[] = { 3364d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */ 3365d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_P2P_PEER, 3366d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt { 3367d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt { "properties", "a{sv}", ARG_OUT }, 3368d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt END_ARGS 3369d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt } 3370d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt }, 337175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { NULL, NULL, { END_ARGS } } 337275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 337375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 337475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 337575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_peer - Send a peer related event signal 337675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 337775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev: peer device object 337875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @interface: name of the interface emitting this signal. 337975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * In case of peer objects, it would be emitted by either 338075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * the "interface object" or by "peer objects" 338175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @sig_name: signal name - DeviceFound 338275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 338375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about event related with newly found p2p peer device 338475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 338575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s, 338675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr, const char *interface, 338775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const char *sig_name) 338875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 338975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *iface; 339075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessage *msg; 339175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen DBusMessageIter iter; 339275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; 339375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 339475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen iface = wpa_s->global->dbus; 339575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 339675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 339775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (iface == NULL) 339875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 339975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 340075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 340175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 340275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(dev_addr)); 340375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 340475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen msg = dbus_message_new_signal(wpa_s->dbus_new_path, interface, 340575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen sig_name); 340675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (msg == NULL) 340775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 340875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 340975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_iter_init_append(msg, &iter); 341075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen path = peer_obj_path; 341175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, 341275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen &path)) 341375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 341475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 341575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_connection_send(iface->con, msg, NULL); 341675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 341775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 341875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 341975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 342075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 342175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); 342275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen dbus_message_unref(msg); 342375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 342475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 342575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 342675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 342775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_peer_found - Send a peer found signal 342875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 342975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev: peer device object 343075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 343175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about find a p2p peer device found 343275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 343375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s, 343475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr) 343575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 343675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_peer(wpa_s, dev_addr, 343775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 343875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "DeviceFound"); 343975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 344075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 344175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 344275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_signal_peer_lost - Send a peer lost signal 344375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: %wpa_supplicant network interface data 344475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev: peer device object 344575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 344675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Notify listeners about lost a p2p peer device 344775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 344875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s, 344975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr) 345075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 345175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_peer(wpa_s, dev_addr, 345275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen WPAS_DBUS_NEW_IFACE_P2PDEVICE, 345375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "DeviceLost"); 345475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 345575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 345675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 345775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_register_peer - Register a discovered peer object with dbus 345875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 345975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ssid: network configuration data 346075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 346175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 346275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Registers network representing object with dbus 346375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 346475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr) 346575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 346675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 346775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_dbus_object_desc *obj_desc; 346875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct peer_handler_args *arg; 346975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 347075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 347175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 347275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 347375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 347475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 347575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 347675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 347775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 347875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 347975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 348075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 348175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(dev_addr)); 348275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 348375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_INFO, "dbus: Register peer object '%s'", 348475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen peer_obj_path); 348575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 348675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc) { 348775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "Not enough memory " 348875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "to create object description"); 348975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 349075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 349175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 349275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* allocate memory for handlers arguments */ 349375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg = os_zalloc(sizeof(struct peer_handler_args)); 349475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!arg) { 349575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "Not enough memory " 349675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "to create arguments for method"); 349775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 349875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 349975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 350075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg->wpa_s = wpa_s; 350175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_memcpy(arg->p2p_device_addr, dev_addr, ETH_ALEN); 350275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 350375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_register(obj_desc, arg, wpa_dbus_free, 350475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen NULL, 350575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_p2p_peer_properties, 350675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_p2p_peer_signals); 350775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 350875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_register_object_per_iface(ctrl_iface, peer_obj_path, 350975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->ifname, obj_desc)) 351075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 351175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 351275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 351375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 351475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 351575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen free_dbus_object_desc(obj_desc); 351675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; 351775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 351875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 351975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 352075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_unregister_peer - Unregister a peer object with dbus 352175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 352275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev_addr: p2p device addr 352375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 352475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 352575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Registers network representing object with dbus 352675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 352775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s, 352875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const u8 *dev_addr) 352975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 353075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 353175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 353275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int ret; 353375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 353475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 353575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL || 353675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path == NULL) 353775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 353875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 353975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 354075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 354175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 354275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 354375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 354475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, MAC2STR(dev_addr)); 354575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 354675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_INFO, "dbus: Unregister peer object '%s'", 354775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen peer_obj_path); 354875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, peer_obj_path); 354975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 355075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return ret; 355175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 355275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 355375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 3554d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtvoid wpas_dbus_signal_peer_groups_changed(struct wpa_supplicant *wpa_s, 3555d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt const u8 *dev_addr) 3556d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt{ 3557d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 3558d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 3559d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 3560d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, 3561d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_s->dbus_new_path, MAC2STR(dev_addr)); 3562d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 3563d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt wpa_dbus_mark_property_changed(wpa_s->global->dbus, peer_obj_path, 3564d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt WPAS_DBUS_NEW_IFACE_P2P_PEER, "Groups"); 3565d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt} 3566d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 3567d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 356875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_property_desc wpas_dbus_p2p_group_properties[] = { 356975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Members", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ao", 35701f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_getter_p2p_group_members, 35711f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt NULL 357275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 357304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "Group", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "o", 357404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group, 357504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 357604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 357704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "Role", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s", 357804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_role, 357904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 358004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 358104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "SSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay", 358204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_ssid, 358304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 358404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 358504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "BSSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay", 358604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_bssid, 358704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 358804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 358904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "Frequency", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "q", 359004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_frequency, 359104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 359204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 359304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "Passphrase", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s", 359404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_passphrase, 359504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 359604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 359704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "PSK", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay", 359804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_psk, 359904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt NULL 360004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt }, 360104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt { "WPSVendorExtensions", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "aay", 360204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_getter_p2p_group_vendor_ext, 360304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt wpas_dbus_setter_p2p_group_vendor_ext 36048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 36051f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { NULL, NULL, NULL, NULL, NULL } 360675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 360775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 360875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_signal_desc wpas_dbus_p2p_group_signals[] = { 360975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PeerJoined", WPAS_DBUS_NEW_IFACE_P2P_GROUP, 36108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 361175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer", "o", ARG_OUT }, 36128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 36138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 36148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 361575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "PeerDisconnected", WPAS_DBUS_NEW_IFACE_P2P_GROUP, 36168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 361775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "peer", "o", ARG_OUT }, 36188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt END_ARGS 36198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 36208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt }, 36218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { NULL, NULL, { END_ARGS } } 36228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}; 36238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 362475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 362575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_register_p2p_group - Register a p2p group object with dbus 362675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 362775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ssid: SSID struct 362875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 362975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 363075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Registers p2p group representing object with dbus 363175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 363275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s, 363375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_ssid *ssid) 363475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 363575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 363675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_dbus_object_desc *obj_desc; 363775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char group_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 363875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 363975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 364075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 364175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 36428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 364375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 364475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 364575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 364675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 364775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_groupobj_path) { 364875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_INFO, "%s: Group object '%s' already exists", 364975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__, wpa_s->dbus_groupobj_path); 365075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 365175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 365275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 365375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpas_dbus_get_group_obj_path(wpa_s, ssid, group_obj_path) < 0) 365475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 365575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 365675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path = os_strdup(group_obj_path); 365775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_groupobj_path == NULL) 365875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 365975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 366075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_INFO, "dbus: Register group object '%s'", 366175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen group_obj_path); 366275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 366375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc) { 366475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "Not enough memory " 366575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "to create object description"); 366675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 366775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 366875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 366975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_register(obj_desc, wpa_s, NULL, NULL, 367075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_p2p_group_properties, 367175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_p2p_group_signals); 367275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 367375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_register_object_per_iface(ctrl_iface, group_obj_path, 367475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->ifname, obj_desc)) 367575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 367675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 367775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 367875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 367975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenerr: 368075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s->dbus_groupobj_path) { 368175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_free(wpa_s->dbus_groupobj_path); 368275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path = NULL; 368375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 368475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 368575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen free_dbus_object_desc(obj_desc); 368675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 368775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 368875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 368975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_unregister_p2p_group - Unregister a p2p group object from dbus 369075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 369175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ssid: network name of the p2p group started 369275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 369375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s, 369475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen const struct wpa_ssid *ssid) 36958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 369675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 369775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 369875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 369975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 370075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 370175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 370275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 370375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 370475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 370575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 370675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!wpa_s->dbus_groupobj_path) { 370775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, 370875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s: Group object '%s' already unregistered", 370975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen __func__, wpa_s->dbus_groupobj_path); 371075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return; 371175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 371275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 3713d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt peer_groups_changed(wpa_s); 3714d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt 371575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Unregister group object '%s'", 371675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path); 371775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 371875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_dbus_unregister_object_per_iface(ctrl_iface, 371975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path); 372075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 372175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_free(wpa_s->dbus_groupobj_path); 372275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_groupobj_path = NULL; 372375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen} 372475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 372575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic const struct wpa_dbus_property_desc 372675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_persistent_group_properties[] = { 372775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen { "Properties", WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, "a{sv}", 372875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_getter_persistent_group_properties, 37291f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt wpas_dbus_setter_persistent_group_properties 373075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen }, 37311f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt { NULL, NULL, NULL, NULL, NULL } 373275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}; 373375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 373475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/* No signals intended for persistent group objects */ 373575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 373675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 373775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_register_persistent_group - Register a configured(saved) 373875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * persistent group with dbus 373975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 374075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @ssid: persistent group (still represented as a network within wpa) 374175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * configuration data 374275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 374375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 374475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Registers a persistent group representing object with dbus. 374575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 374675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_register_persistent_group(struct wpa_supplicant *wpa_s, 374775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_ssid *ssid) 374875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{ 374975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpas_dbus_priv *ctrl_iface; 375075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct wpa_dbus_object_desc *obj_desc; 375175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen struct network_handler_args *arg; 375275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 375375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 375475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Do nothing if the control interface is not turned on */ 375575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL) 375675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 375775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 375875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* Make sure ssid is a persistent group */ 375975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ssid->disabled != 2 && !ssid->p2p_persistent_group) 376075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return -1; /* should we return w/o complaining? */ 376175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 376275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ctrl_iface = wpa_s->global->dbus; 376375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (ctrl_iface == NULL) 376475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return 0; 376575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 376675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* 376775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Intentionally not coming up with different numbering scheme 376875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * for persistent groups. 376975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 377075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 377175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u", 377275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, ssid->id); 377375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 377475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Register persistent group object '%s'", 377575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen pgrp_obj_path); 377675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); 377775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!obj_desc) { 377875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Not enough memory to create " 377975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "object description"); 378075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 378175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 378275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 378375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* 378475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Reusing the same context structure as that for networks 378575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * since these are represented using same data structure. 378675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 378775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen /* allocate memory for handlers arguments */ 378875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg = os_zalloc(sizeof(struct network_handler_args)); 378975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!arg) { 379075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_ERROR, "dbus: Not enough memory to create " 379175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "arguments for method"); 379275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 379375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen } 379475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 379575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg->wpa_s = wpa_s; 379675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen arg->ssid = ssid; 379775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 379875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL, 379975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_persistent_group_properties, 380075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen NULL); 380175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 380275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_dbus_register_object_per_iface(ctrl_iface, pgrp_obj_path, 380375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->ifname, obj_desc)) 380475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen goto err; 380575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 380675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_persistent_group_added(wpa_s, ssid->id); 38078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 38088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 38098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 38108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidterr: 38118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt free_dbus_object_desc(obj_desc); 38128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return -1; 38138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 38148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 38158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 381675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/** 381775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_dbus_unregister_persistent_group - Unregister a persistent_group 381875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * from dbus 381975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @wpa_s: wpa_supplicant interface structure 382075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @nid: network id 382175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Returns: 0 on success, -1 on failure 382275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 382375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * Unregisters persistent group representing object from dbus 382475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * 382575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * NOTE: There is a slight issue with the semantics here. While the 382675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * implementation simply means the persistent group is unloaded from memory, 382775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * it should not get interpreted as the group is actually being erased/removed 382875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * from persistent storage as well. 382975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */ 383075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenint wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s, 383175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int nid) 38328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 38338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt struct wpas_dbus_priv *ctrl_iface; 383475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; 383575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen int ret; 38368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 38378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* Do nothing if the control interface is not turned on */ 383875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (wpa_s == NULL || wpa_s->global == NULL || 383975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path == NULL) 38408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 38418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt ctrl_iface = wpa_s->global->dbus; 38428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (ctrl_iface == NULL) 38438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return 0; 38448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 384575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, 384675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u", 384775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_s->dbus_new_path, nid); 38488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 384975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpa_printf(MSG_DEBUG, "dbus: Unregister persistent group object '%s'", 385075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen pgrp_obj_path); 385175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, pgrp_obj_path); 38528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 385375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen if (!ret) 385475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen wpas_dbus_signal_persistent_group_removed(wpa_s, nid); 38558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 385675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen return ret; 38578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 385875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen 385975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */ 3860