blob: f94873d880f17e0f066e2280d2602c8f339e187e [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * wpa_supplicant - Event notifications
3 * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
4 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#include "utils/includes.h"
10
11#include "utils/common.h"
12#include "common/wpa_ctrl.h"
13#include "config.h"
14#include "wpa_supplicant_i.h"
15#include "wps_supplicant.h"
16#include "dbus/dbus_common.h"
17#include "dbus/dbus_old.h"
18#include "dbus/dbus_new.h"
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080019#include "rsn_supp/wpa.h"
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080020#include "fst/fst.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070021#include "driver_i.h"
22#include "scan.h"
23#include "p2p_supplicant.h"
24#include "sme.h"
25#include "notify.h"
Roshan Pius9322a342016-12-12 14:45:02 -080026#include "hidl/hidl.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070027
28int wpas_notify_supplicant_initialized(struct wpa_global *global)
29{
30#ifdef CONFIG_DBUS
31 if (global->params.dbus_ctrl_interface) {
32 global->dbus = wpas_dbus_init(global);
33 if (global->dbus == NULL)
34 return -1;
35 }
36#endif /* CONFIG_DBUS */
37
Roshan Pius57ffbcf2016-09-27 09:12:46 -070038#ifdef CONFIG_HIDL
39 global->hidl = wpas_hidl_init(global);
40 if (!global->hidl)
Dmitry Shmidte4663042016-04-04 10:07:49 -070041 return -1;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070042#endif /* CONFIG_HIDL */
Dmitry Shmidte4663042016-04-04 10:07:49 -070043
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070044 return 0;
45}
46
47
48void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
49{
50#ifdef CONFIG_DBUS
51 if (global->dbus)
52 wpas_dbus_deinit(global->dbus);
53#endif /* CONFIG_DBUS */
Dmitry Shmidte4663042016-04-04 10:07:49 -070054
Roshan Pius57ffbcf2016-09-27 09:12:46 -070055#ifdef CONFIG_HIDL
56 if (global->hidl)
57 wpas_hidl_deinit(global->hidl);
58#endif /* CONFIG_HIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070059}
60
61
62int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
63{
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080064 if (!wpa_s->p2p_mgmt) {
65 if (wpas_dbus_register_iface(wpa_s))
66 return -1;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080067
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080068 if (wpas_dbus_register_interface(wpa_s))
69 return -1;
70 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070071
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080072 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Roshan Pius57ffbcf2016-09-27 09:12:46 -070073 if (wpas_hidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070074 return -1;
75
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070076 return 0;
77}
78
79
80void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
81{
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080082 if (!wpa_s->p2p_mgmt) {
83 /* unregister interface in old DBus ctrl iface */
84 wpas_dbus_unregister_iface(wpa_s);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080085
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080086 /* unregister interface in new DBus ctrl iface */
87 wpas_dbus_unregister_interface(wpa_s);
88 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070089
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080090 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Roshan Pius57ffbcf2016-09-27 09:12:46 -070091 wpas_hidl_unregister_interface(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070092}
93
94
95void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
96 enum wpa_states new_state,
97 enum wpa_states old_state)
98{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080099 if (wpa_s->p2p_mgmt)
100 return;
101
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700102 /* notify the old DBus API */
103 wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
104 old_state);
105
106 /* notify the new DBus API */
107 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
108
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800109#ifdef CONFIG_FST
110 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
111 if (new_state == WPA_COMPLETED)
112 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
113 else if (old_state >= WPA_ASSOCIATED &&
114 new_state < WPA_ASSOCIATED)
115 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
116 }
117#endif /* CONFIG_FST */
118
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700119 if (new_state == WPA_COMPLETED)
120 wpas_p2p_notif_connected(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700121 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700122 wpas_p2p_notif_disconnected(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700123
124 sme_state_changed(wpa_s);
125
126#ifdef ANDROID
127 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
Irfan Sherifff20a4432012-04-16 16:48:34 -0700128 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700129 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
Irfan Sherifff20a4432012-04-16 16:48:34 -0700130 new_state,
Irfan Sheriffe78e7672012-08-01 11:10:15 -0700131 MAC2STR(wpa_s->bssid),
andy2_kuo5b5fb022012-05-22 11:53:07 -0700132 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
133 wpa_ssid_txt(wpa_s->current_ssid->ssid,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800134 wpa_s->current_ssid->ssid_len) : "");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700135#endif /* ANDROID */
Roshan Piuse8d0d162016-08-01 13:09:26 -0700136
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700137 wpas_hidl_notify_state_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700138}
139
140
Dmitry Shmidt04949592012-07-19 12:16:46 -0700141void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
142{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800143 if (wpa_s->p2p_mgmt)
144 return;
145
Dmitry Shmidt04949592012-07-19 12:16:46 -0700146 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
Roshan Pius0974e962016-12-12 17:05:51 -0800147
148 wpas_hidl_notify_assoc_reject(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700149}
150
151
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800152void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s)
153{
154 if (wpa_s->p2p_mgmt)
155 return;
156
157 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800158
159 wpas_hidl_notify_assoc_reject(wpa_s);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800160}
161
162
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700163void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
164{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800165 if (wpa_s->p2p_mgmt)
166 return;
167
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700168 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
169}
170
171
172void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
173{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800174 if (wpa_s->p2p_mgmt)
175 return;
176
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700177 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
178}
179
180
181void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
182{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800183 if (wpa_s->p2p_mgmt)
184 return;
185
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700186 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
187}
188
189
190void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
191{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800192 if (wpa_s->p2p_mgmt)
193 return;
194
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700195 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
196}
197
198
199void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
200 struct wpa_ssid *ssid)
201{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800202 if (wpa_s->p2p_mgmt)
203 return;
204
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700205 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
206}
207
208
209void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
210 struct wpa_ssid *ssid)
211{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800212 if (wpa_s->p2p_mgmt)
213 return;
214
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700215 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
216}
217
218
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800219void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
220 struct wpa_ssid *ssid,
221 enum wpa_ctrl_req_type rtype,
222 const char *default_txt)
223{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800224 if (wpa_s->p2p_mgmt)
225 return;
226
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800227 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700228
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700229 wpas_hidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800230}
231
232
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700233void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
234{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800235 if (wpa_s->p2p_mgmt)
236 return;
237
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700238 /* notify the old DBus API */
239 wpa_supplicant_dbus_notify_scanning(wpa_s);
240
241 /* notify the new DBus API */
242 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
243}
244
245
246void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
247{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800248 if (wpa_s->p2p_mgmt)
249 return;
250
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700251 wpas_dbus_signal_scan_done(wpa_s, success);
252}
253
254
255void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
256{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800257 if (wpa_s->p2p_mgmt)
258 return;
259
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700260 /* notify the old DBus API */
261 wpa_supplicant_dbus_notify_scan_results(wpa_s);
262
263 wpas_wps_notify_scan_results(wpa_s);
264}
265
266
267void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
268 const struct wps_credential *cred)
269{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800270 if (wpa_s->p2p_mgmt)
271 return;
272
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700273#ifdef CONFIG_WPS
274 /* notify the old DBus API */
275 wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
276 /* notify the new DBus API */
277 wpas_dbus_signal_wps_cred(wpa_s, cred);
278#endif /* CONFIG_WPS */
279}
280
281
282void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
283 struct wps_event_m2d *m2d)
284{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800285 if (wpa_s->p2p_mgmt)
286 return;
287
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700288#ifdef CONFIG_WPS
289 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
290#endif /* CONFIG_WPS */
291}
292
293
294void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
295 struct wps_event_fail *fail)
296{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800297 if (wpa_s->p2p_mgmt)
298 return;
299
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700300#ifdef CONFIG_WPS
301 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800302
303 wpas_hidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
304 fail->config_error,
305 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700306#endif /* CONFIG_WPS */
307}
308
309
310void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
311{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800312 if (wpa_s->p2p_mgmt)
313 return;
314
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700315#ifdef CONFIG_WPS
316 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800317
318 wpas_hidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700319#endif /* CONFIG_WPS */
320}
321
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700322void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
323{
324 if (wpa_s->p2p_mgmt)
325 return;
326
327#ifdef CONFIG_WPS
328 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800329
330 wpas_hidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700331#endif /* CONFIG_WPS */
332}
333
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700334
335void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
336 struct wpa_ssid *ssid)
337{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800338 if (wpa_s->p2p_mgmt)
339 return;
340
Jouni Malinen75ecf522011-06-27 15:19:46 -0700341 /*
342 * Networks objects created during any P2P activities should not be
343 * exposed out. They might/will confuse certain non-P2P aware
344 * applications since these network objects won't behave like
345 * regular ones.
346 */
Roshan Piusd3854452016-07-07 16:46:41 -0700347 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700348 wpas_dbus_register_network(wpa_s, ssid);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700349 wpas_hidl_register_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700350 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700351}
352
353
354void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
355 struct wpa_ssid *ssid)
356{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700357#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700358 wpas_dbus_register_persistent_group(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700359#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700360}
361
362
363void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
364 struct wpa_ssid *ssid)
365{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700366#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700367 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700368#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700369}
370
371
372void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
373 struct wpa_ssid *ssid)
374{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800375 if (wpa_s->next_ssid == ssid)
376 wpa_s->next_ssid = NULL;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800377 if (wpa_s->wpa)
378 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700379 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700380 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700381 wpas_dbus_unregister_network(wpa_s, ssid->id);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700382 wpas_hidl_unregister_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700383 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800384 if (network_is_persistent_group(ssid))
385 wpas_notify_persistent_group_removed(wpa_s, ssid);
386
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800387 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700388}
389
390
391void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
392 u8 bssid[], unsigned int id)
393{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800394 if (wpa_s->p2p_mgmt)
395 return;
396
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700397 wpas_dbus_register_bss(wpa_s, bssid, id);
398 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
399 id, MAC2STR(bssid));
400}
401
402
403void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
404 u8 bssid[], unsigned int id)
405{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800406 if (wpa_s->p2p_mgmt)
407 return;
408
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700409 wpas_dbus_unregister_bss(wpa_s, bssid, id);
410 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
411 id, MAC2STR(bssid));
412}
413
414
415void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
416 unsigned int id)
417{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800418 if (wpa_s->p2p_mgmt)
419 return;
420
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700421 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
422}
423
424
425void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
426 unsigned int id)
427{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800428 if (wpa_s->p2p_mgmt)
429 return;
430
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700431 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
432 id);
433}
434
435
436void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
437 unsigned int id)
438{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800439 if (wpa_s->p2p_mgmt)
440 return;
441
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700442 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
443 id);
444}
445
446
447void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
448 unsigned int id)
449{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800450 if (wpa_s->p2p_mgmt)
451 return;
452
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700453 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
454}
455
456
457void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
458 unsigned int id)
459{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800460 if (wpa_s->p2p_mgmt)
461 return;
462
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700463 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
464}
465
466
467void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
468 unsigned int id)
469{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800470 if (wpa_s->p2p_mgmt)
471 return;
472
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700473 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
474}
475
476
477void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
478 unsigned int id)
479{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800480 if (wpa_s->p2p_mgmt)
481 return;
482
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800483#ifdef CONFIG_WPS
484 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
485#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700486}
487
488
489void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
490 unsigned int id)
491{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800492 if (wpa_s->p2p_mgmt)
493 return;
494
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700495 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
496}
497
498
499void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
500 unsigned int id)
501{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800502 if (wpa_s->p2p_mgmt)
503 return;
504
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700505 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
506}
507
508
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700509void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
510{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800511 if (wpa_s->p2p_mgmt)
512 return;
513
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700514 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
515}
516
517
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700518void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
519{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800520 if (wpa_s->p2p_mgmt)
521 return;
522
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700523 wpas_dbus_signal_blob_added(wpa_s, name);
524}
525
526
527void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
528{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800529 if (wpa_s->p2p_mgmt)
530 return;
531
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700532 wpas_dbus_signal_blob_removed(wpa_s, name);
533}
534
535
536void wpas_notify_debug_level_changed(struct wpa_global *global)
537{
538 wpas_dbus_signal_debug_level_changed(global);
539}
540
541
542void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
543{
544 wpas_dbus_signal_debug_timestamp_changed(global);
545}
546
547
548void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
549{
550 wpas_dbus_signal_debug_show_keys_changed(global);
551}
552
553
554void wpas_notify_suspend(struct wpa_global *global)
555{
556 struct wpa_supplicant *wpa_s;
557
558 os_get_time(&global->suspend_time);
559 wpa_printf(MSG_DEBUG, "System suspend notification");
560 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
561 wpa_drv_suspend(wpa_s);
562}
563
564
565void wpas_notify_resume(struct wpa_global *global)
566{
567 struct os_time now;
568 int slept;
569 struct wpa_supplicant *wpa_s;
570
571 if (global->suspend_time.sec == 0)
572 slept = -1;
573 else {
574 os_get_time(&now);
575 slept = now.sec - global->suspend_time.sec;
576 }
577 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
578 slept);
579
580 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
581 wpa_drv_resume(wpa_s);
582 if (wpa_s->wpa_state == WPA_DISCONNECTED)
583 wpa_supplicant_req_scan(wpa_s, 0, 100000);
584 }
585}
586
587
588#ifdef CONFIG_P2P
589
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700590void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
591{
592 /* Notify P2P find has stopped */
593 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800594
595 wpas_hidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700596}
597
598
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700599void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800600 const u8 *addr, const struct p2p_peer_info *info,
601 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
602 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700603{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700604 if (new_device) {
605 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800606 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700607 }
608
609 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800610 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
611
612 wpas_hidl_notify_p2p_device_found(wpa_s, addr, info,
613 peer_wfd_device_info,
614 peer_wfd_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700615}
616
617
618void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
619 const u8 *dev_addr)
620{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700621 wpas_dbus_unregister_peer(wpa_s, dev_addr);
622
623 /* Create signal on interface object*/
624 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800625
626 wpas_hidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700627}
628
629
630void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
631 const struct wpa_ssid *ssid,
632 const char *role)
633{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700634 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700635
636 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800637
638 wpas_hidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700639}
640
641
642void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700643 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700644{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700645 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800646
647 wpas_hidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700648}
649
650
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800651void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
652 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700653{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800654 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800655
656 wpas_hidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700657}
658
659
660void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
661 int status, const u8 *bssid)
662{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700663 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800664
665 wpas_hidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700666}
667
668
669void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
670 int freq, const u8 *sa, u8 dialog_token,
671 u16 update_indic, const u8 *tlvs,
672 size_t tlvs_len)
673{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700674 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
675 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700676}
677
678
679void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
680 const u8 *sa, u16 update_indic,
681 const u8 *tlvs, size_t tlvs_len)
682{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700683 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
684 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800685
686 wpas_hidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
687 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700688}
689
690
691/**
692 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
693 * @dev_addr: Who sent the request or responded to our request.
694 * @request: Will be 1 if request, 0 for response.
695 * @status: Valid only in case of response (0 in case of success)
696 * @config_methods: WPS config methods
697 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
698 *
699 * This can be used to notify:
700 * - Requests or responses
701 * - Various config methods
702 * - Failure condition in case of response
703 */
704void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
705 const u8 *dev_addr, int request,
706 enum p2p_prov_disc_status status,
707 u16 config_methods,
708 unsigned int generated_pin)
709{
710 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
711 status, config_methods,
712 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800713
714 wpas_hidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
715 status, config_methods,
716 generated_pin);
717
Jouni Malinen75ecf522011-06-27 15:19:46 -0700718}
719
720
721void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700722 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800723 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700724{
725 /* Notify a group has been started */
726 wpas_dbus_register_p2p_group(wpa_s, ssid);
727
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800728 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800729
730 wpas_hidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700731}
732
733
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800734void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
735 const char *reason)
736{
737 /* Notify a group formation failed */
738 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800739
740 wpas_hidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800741}
742
743
Jouni Malinen75ecf522011-06-27 15:19:46 -0700744void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
745 struct wps_event_fail *fail)
746{
747 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700748}
749
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800750
751void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
752 const u8 *sa, const u8 *go_dev_addr,
753 const u8 *bssid, int id, int op_freq)
754{
755 /* Notify a P2P Invitation Request */
756 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
757 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800758
759 wpas_hidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
760 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800761}
762
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700763#endif /* CONFIG_P2P */
764
765
766static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800767 const u8 *sta,
768 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700769{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700770#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800771 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
772
Jouni Malinen75ecf522011-06-27 15:19:46 -0700773 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700774 * Create 'peer-joined' signal on group object -- will also
775 * check P2P itself.
776 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800777 if (p2p_dev_addr)
778 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700779#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700780
781 /* Notify listeners a new station has been authorized */
782 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800783
784 wpas_hidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700785}
786
787
788static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700789 const u8 *sta,
790 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700791{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700792#ifdef CONFIG_P2P
793 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700794 * Create 'peer-disconnected' signal on group object if this
795 * is a P2P group.
796 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800797 if (p2p_dev_addr)
798 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700799#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700800
801 /* Notify listeners a station has been deauthorized */
802 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800803
804 wpas_hidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700805}
806
807
808void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800809 const u8 *mac_addr, int authorized,
810 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700811{
812 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800813 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700814 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700815 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700816}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700817
818
819void wpas_notify_certification(struct wpa_supplicant *wpa_s, int depth,
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800820 const char *subject, const char *altsubject[],
821 int num_altsubject, const char *cert_hash,
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700822 const struct wpabuf *cert)
823{
824 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
825 "depth=%d subject='%s'%s%s",
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800826 depth, subject, cert_hash ? " hash=" : "",
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700827 cert_hash ? cert_hash : "");
828
829 if (cert) {
830 char *cert_hex;
831 size_t len = wpabuf_len(cert) * 2 + 1;
832 cert_hex = os_malloc(len);
833 if (cert_hex) {
834 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert),
835 wpabuf_len(cert));
836 wpa_msg_ctrl(wpa_s, MSG_INFO,
837 WPA_EVENT_EAP_PEER_CERT
838 "depth=%d subject='%s' cert=%s",
839 depth, subject, cert_hex);
840 os_free(cert_hex);
841 }
842 }
843
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800844 if (altsubject) {
845 int i;
846
847 for (i = 0; i < num_altsubject; i++)
848 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
849 "depth=%d %s", depth, altsubject[i]);
850 }
851
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700852 /* notify the old DBus API */
853 wpa_supplicant_dbus_notify_certification(wpa_s, depth, subject,
854 cert_hash, cert);
855 /* notify the new DBus API */
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800856 wpas_dbus_signal_certification(wpa_s, depth, subject, altsubject,
857 num_altsubject, cert_hash, cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700858}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700859
860
861void wpas_notify_preq(struct wpa_supplicant *wpa_s,
862 const u8 *addr, const u8 *dst, const u8 *bssid,
863 const u8 *ie, size_t ie_len, u32 ssi_signal)
864{
865#ifdef CONFIG_AP
866 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
867#endif /* CONFIG_AP */
868}
869
870
871void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
872 const char *parameter)
873{
874 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700875 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
876 "status='%s' parameter='%s'",
877 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700878}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700879
880
881void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
882 struct wpa_ssid *ssid)
883{
884 if (wpa_s->current_ssid != ssid)
885 return;
886
887 wpa_dbg(wpa_s, MSG_DEBUG,
888 "Network bssid config changed for the current network - within-ESS roaming %s",
889 ssid->bssid_set ? "disabled" : "enabled");
890
891 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
892 ssid->bssid_set ? ssid->bssid : NULL);
893}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800894
895
896void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
897 struct wpa_ssid *ssid)
898{
899#ifdef CONFIG_P2P
900 if (ssid->disabled == 2) {
901 /* Changed from normal network profile to persistent group */
902 ssid->disabled = 0;
903 wpas_dbus_unregister_network(wpa_s, ssid->id);
904 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700905 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800906 wpas_dbus_register_persistent_group(wpa_s, ssid);
907 } else {
908 /* Changed from persistent group to normal network profile */
909 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700910 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800911 wpas_dbus_register_network(wpa_s, ssid);
912 }
913#endif /* CONFIG_P2P */
914}
Roshan Pius04a9d742016-12-12 12:40:46 -0800915
916void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
917 const char *result,
918 const struct wpa_bss_anqp *anqp)
919{
920#ifdef CONFIG_INTERWORKING
921 if (!wpa_s || !bssid || !anqp)
922 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800923
924 wpas_hidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -0800925#endif /* CONFIG_INTERWORKING */
926}
927
928void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
929 const char* file_name, const u8* image,
930 u32 image_length)
931{
932#ifdef CONFIG_HS20
933 if (!wpa_s || !bssid || !file_name || !image)
934 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800935
936 wpas_hidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
937 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -0800938#endif /* CONFIG_HS20 */
939}
940
941void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
942 const char* url,
943 u8 osu_method)
944{
945#ifdef CONFIG_HS20
946 if (!wpa_s || !url)
947 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800948
949 wpas_hidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -0800950#endif /* CONFIG_HS20 */
951}
952
953void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
954 u8 code, u16 reauth_delay,
955 const char *url)
956{
957#ifdef CONFIG_HS20
958 if (!wpa_s || !url)
959 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800960
961 wpas_hidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
962 url);
Roshan Pius04a9d742016-12-12 12:40:46 -0800963#endif /* CONFIG_HS20 */
964}