notify.c revision 75ecf5267604f166b85a7ee2cf0d9cb682966680
18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/*
28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_supplicant - Event notifications
38d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
58d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This program is free software; you can redistribute it and/or modify
68d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * it under the terms of the GNU General Public License version 2 as
78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * published by the Free Software Foundation.
88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Alternatively, this software may be distributed under the terms of BSD
108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * license.
118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * See README and COPYING for more details.
138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "utils/includes.h"
168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "utils/common.h"
188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "common/wpa_ctrl.h"
198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "config.h"
208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "wpa_supplicant_i.h"
218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "wps_supplicant.h"
228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "dbus/dbus_common.h"
238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "dbus/dbus_old.h"
248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "dbus/dbus_new.h"
258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "driver_i.h"
268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "scan.h"
278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "p2p_supplicant.h"
288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "sme.h"
298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "notify.h"
308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_notify_supplicant_initialized(struct wpa_global *global)
328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_DBUS
348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (global->params.dbus_ctrl_interface) {
358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		global->dbus = wpas_dbus_init(global);
368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		if (global->dbus == NULL)
378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			return -1;
388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	}
398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_DBUS */
408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return 0;
428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_supplicant_deinitialized(struct wpa_global *global)
468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_DBUS
488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (global->dbus)
498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		wpas_dbus_deinit(global->dbus);
508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_DBUS */
518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (wpas_dbus_register_iface(wpa_s))
578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return -1;
588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (wpas_dbus_register_interface(wpa_s))
608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return -1;
618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return 0;
638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* unregister interface in old DBus ctrl iface */
698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_unregister_iface(wpa_s);
708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* unregister interface in new DBus ctrl iface */
728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_unregister_interface(wpa_s);
738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			       enum wpa_states new_state,
788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			       enum wpa_states old_state)
798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* notify the old DBus API */
818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt						old_state);
838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* notify the new DBus API */
858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_P2P
888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (new_state == WPA_COMPLETED)
898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		wpas_p2p_notif_connected(wpa_s);
908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	else if (new_state < WPA_ASSOCIATED)
918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		wpas_p2p_notif_disconnected(wpa_s);
928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_P2P */
938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	sme_state_changed(wpa_s);
958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef ANDROID
978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     "id=%d state=%d BSSID=" MACSTR,
998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
1008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     new_state, MAC2STR(wpa_s->pending_bssid));
1018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* ANDROID */
1028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
1068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
1088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
1148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
1188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
1208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					 struct wpa_ssid *ssid)
1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				  struct wpa_ssid *ssid)
1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_network_selected(wpa_s, ssid->id);
1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_scanning(struct wpa_supplicant *wpa_s)
1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* notify the old DBus API */
1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_supplicant_dbus_notify_scanning(wpa_s);
1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* notify the new DBus API */
1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_scan_done(wpa_s, success);
1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* notify the old DBus API */
1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_supplicant_dbus_notify_scan_results(wpa_s);
1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_wps_notify_scan_results(wpa_s);
1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				const struct wps_credential *cred)
1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS
1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* notify the old DBus API */
1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* notify the new DBus API */
1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_wps_cred(wpa_s, cred);
1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */
1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
1818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			       struct wps_event_m2d *m2d)
1828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS
1848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */
1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				struct wps_event_fail *fail)
1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS
1938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_wps_event_fail(wpa_s, fail);
1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */
1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS
2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_wps_event_success(wpa_s);
2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */
2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_network_added(struct wpa_supplicant *wpa_s,
2078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			       struct wpa_ssid *ssid)
2088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
20975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/*
21075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * Networks objects created during any P2P activities should not be
21175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * exposed out. They might/will confuse certain non-P2P aware
21275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * applications since these network objects won't behave like
21375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * regular ones.
21475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 */
21575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	if (wpa_s->global->p2p_group_formation != wpa_s)
21675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen		wpas_dbus_register_network(wpa_s, ssid);
21775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}
21875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
21975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
22075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
22175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					struct wpa_ssid *ssid)
22275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{
22375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_register_persistent_group(wpa_s, ssid);
22475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}
22575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
22675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
22775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
22875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					  struct wpa_ssid *ssid)
22975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{
23075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
2318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
2358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 struct wpa_ssid *ssid)
2368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
23775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	if (wpa_s->global->p2p_group_formation != wpa_s)
23875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen		wpas_dbus_unregister_network(wpa_s, ssid->id);
2398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
2438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			   u8 bssid[], unsigned int id)
2448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_register_bss(wpa_s, bssid, id);
2468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     id, MAC2STR(bssid));
2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     u8 bssid[], unsigned int id)
2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_unregister_bss(wpa_s, bssid, id);
2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     id, MAC2STR(bssid));
2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				  unsigned int id)
2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
2688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				    unsigned int id)
2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					  id);
2728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				     unsigned int id)
2778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					  id);
2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				  unsigned int id)
2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
2878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
2918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   unsigned int id)
2928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
2988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   unsigned int id)
2998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
3018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 unsigned int id)
3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   unsigned int id)
3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   unsigned int id)
3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_blob_added(wpa_s, name);
3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
3318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_blob_removed(wpa_s, name);
3338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_debug_level_changed(struct wpa_global *global)
3378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_debug_level_changed(global);
3398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_debug_timestamp_changed(struct wpa_global *global)
3438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_debug_timestamp_changed(global);
3458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_debug_show_keys_changed(struct wpa_global *global)
3498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpas_dbus_signal_debug_show_keys_changed(global);
3518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_suspend(struct wpa_global *global)
3558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpa_supplicant *wpa_s;
3578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	os_get_time(&global->suspend_time);
3598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_printf(MSG_DEBUG, "System suspend notification");
3608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
3618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		wpa_drv_suspend(wpa_s);
3628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_resume(struct wpa_global *global)
3668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
3678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct os_time now;
3688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int slept;
3698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpa_supplicant *wpa_s;
3708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (global->suspend_time.sec == 0)
3728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		slept = -1;
3738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	else {
3748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		os_get_time(&now);
3758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		slept = now.sec - global->suspend_time.sec;
3768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	}
3778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
3788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		   slept);
3798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
3818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		wpa_drv_resume(wpa_s);
3828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		if (wpa_s->wpa_state == WPA_DISCONNECTED)
3838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			wpa_supplicant_req_scan(wpa_s, 0, 100000);
3848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	}
3858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_P2P
3898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
3918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				  const u8 *dev_addr, int new_device)
3928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
39375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	if (new_device) {
39475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen		/* Create the new peer object */
39575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen		wpas_dbus_register_peer(wpa_s, dev_addr);
39675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	}
39775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
39875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/* Notify a new peer has been detected*/
39975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_peer_device_found(wpa_s, dev_addr);
4008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
4018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
4048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 const u8 *dev_addr)
4058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
40675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_unregister_peer(wpa_s, dev_addr);
40775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
40875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/* Create signal on interface object*/
40975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
4108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
4118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
4148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   const struct wpa_ssid *ssid,
4158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   const char *role)
4168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
41775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_unregister_p2p_group(wpa_s, ssid);
41875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
41975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_group_removed(wpa_s, role);
4208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
4218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
4248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				const u8 *src, u16 dev_passwd_id)
4258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
42675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id);
4278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
4288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s, int status)
4318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
43275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_go_neg_resp(wpa_s, status);
4338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
4348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
4378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				       int status, const u8 *bssid)
4388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
43975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
4408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
4418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
4448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				int freq, const u8 *sa, u8 dialog_token,
4458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				u16 update_indic, const u8 *tlvs,
4468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				size_t tlvs_len)
4478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
44875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
44975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					update_indic, tlvs, tlvs_len);
4508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
4518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
4548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 const u8 *sa, u16 update_indic,
4558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 const u8 *tlvs, size_t tlvs_len)
4568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
45775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
45875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					 tlvs, tlvs_len);
45975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}
46075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
46175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
46275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen/**
46375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * wpas_notify_p2p_provision_discovery - Notification of provision discovery
46475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @dev_addr: Who sent the request or responded to our request.
46575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @request: Will be 1 if request, 0 for response.
46675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @status: Valid only in case of response (0 in case of success)
46775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @config_methods: WPS config methods
46875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
46975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen *
47075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * This can be used to notify:
47175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * - Requests or responses
47275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * - Various config methods
47375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen * - Failure condition in case of response
47475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen */
47575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
47675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					 const u8 *dev_addr, int request,
47775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					 enum p2p_prov_disc_status status,
47875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					 u16 config_methods,
47975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					 unsigned int generated_pin)
48075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{
48175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
48275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen						 status, config_methods,
48375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen						 generated_pin);
48475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}
48575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
48675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
48775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
48875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen				   struct wpa_ssid *ssid, int network_id,
48975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen				   int client)
49075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{
49175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/* Notify a group has been started */
49275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_register_p2p_group(wpa_s, ssid);
49375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
49475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_group_started(wpa_s, ssid, client, network_id);
49575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}
49675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
49775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
49875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenvoid wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
49975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen				struct wps_event_fail *fail)
50075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{
50175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
5028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
5038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_P2P */
5058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
5088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					  const u8 *sta)
5098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
51075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P
51175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/*
51275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * Register a group member object corresponding to this peer and
51375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * emit a PeerJoined signal. This will check if it really is a
51475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * P2P group.
51575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 */
51675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_register_p2p_groupmember(wpa_s, sta);
51775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
51875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/*
51975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * Create 'peer-joined' signal on group object -- will also
52075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * check P2P itself.
52175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 */
52275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_peer_joined(wpa_s, sta);
52375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */
5248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
5258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
5288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					    const u8 *sta)
5298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
53075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#ifdef CONFIG_P2P
53175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/*
53275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * Unregister a group member object corresponding to this peer
53375ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * if this is a P2P group.
53475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 */
53575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_unregister_p2p_groupmember(wpa_s, sta);
53675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
53775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	/*
53875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * Create 'peer-disconnected' signal on group object if this
53975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 * is a P2P group.
54075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	 */
54175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	wpas_dbus_signal_p2p_peer_disconnected(wpa_s, sta);
54275ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen#endif /* CONFIG_P2P */
5438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
5448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
5478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				const u8 *mac_addr, int authorized)
5488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
5498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (authorized)
5508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		wpas_notify_ap_sta_authorized(wpa_s, mac_addr);
5518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	else
5528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr);
5538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
554