blob: d7adaa01745e682c496a9dece126e1427c5293d7 [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
Roshan Piusbe158772017-03-10 17:54:37 -0800148 wpas_hidl_notify_disconnect_reason(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
Roshan Pius38e96762017-01-23 14:52:00 -0800162void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
163 if (wpa_s->p2p_mgmt)
164 return;
165
166 wpas_hidl_notify_auth_timeout(wpa_s);
167}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800168
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700169void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
170{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800171 if (wpa_s->p2p_mgmt)
172 return;
173
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700174 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
175}
176
177
178void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
179{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800180 if (wpa_s->p2p_mgmt)
181 return;
182
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700183 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
184}
185
186
187void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
188{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800189 if (wpa_s->p2p_mgmt)
190 return;
191
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700192 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700193
194 wpas_hidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700195}
196
197
198void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
199{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800200 if (wpa_s->p2p_mgmt)
201 return;
202
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700203 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
204}
205
206
207void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
208 struct wpa_ssid *ssid)
209{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800210 if (wpa_s->p2p_mgmt)
211 return;
212
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700213 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
214}
215
216
217void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
218 struct wpa_ssid *ssid)
219{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800220 if (wpa_s->p2p_mgmt)
221 return;
222
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700223 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
224}
225
226
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800227void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
228 struct wpa_ssid *ssid,
229 enum wpa_ctrl_req_type rtype,
230 const char *default_txt)
231{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800232 if (wpa_s->p2p_mgmt)
233 return;
234
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800235 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700236
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700237 wpas_hidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800238}
239
240
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700241void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
242{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800243 if (wpa_s->p2p_mgmt)
244 return;
245
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700246 /* notify the old DBus API */
247 wpa_supplicant_dbus_notify_scanning(wpa_s);
248
249 /* notify the new DBus API */
250 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
251}
252
253
254void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
255{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800256 if (wpa_s->p2p_mgmt)
257 return;
258
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700259 wpas_dbus_signal_scan_done(wpa_s, success);
260}
261
262
263void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
264{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800265 if (wpa_s->p2p_mgmt)
266 return;
267
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700268 /* notify the old DBus API */
269 wpa_supplicant_dbus_notify_scan_results(wpa_s);
270
271 wpas_wps_notify_scan_results(wpa_s);
272}
273
274
275void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
276 const struct wps_credential *cred)
277{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800278 if (wpa_s->p2p_mgmt)
279 return;
280
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700281#ifdef CONFIG_WPS
282 /* notify the old DBus API */
283 wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
284 /* notify the new DBus API */
285 wpas_dbus_signal_wps_cred(wpa_s, cred);
286#endif /* CONFIG_WPS */
287}
288
289
290void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
291 struct wps_event_m2d *m2d)
292{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800293 if (wpa_s->p2p_mgmt)
294 return;
295
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700296#ifdef CONFIG_WPS
297 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
298#endif /* CONFIG_WPS */
299}
300
301
302void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
303 struct wps_event_fail *fail)
304{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800305 if (wpa_s->p2p_mgmt)
306 return;
307
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700308#ifdef CONFIG_WPS
309 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800310
311 wpas_hidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
312 fail->config_error,
313 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700314#endif /* CONFIG_WPS */
315}
316
317
318void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
319{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800320 if (wpa_s->p2p_mgmt)
321 return;
322
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700323#ifdef CONFIG_WPS
324 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800325
326 wpas_hidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700327#endif /* CONFIG_WPS */
328}
329
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700330void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
331{
332 if (wpa_s->p2p_mgmt)
333 return;
334
335#ifdef CONFIG_WPS
336 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800337
338 wpas_hidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700339#endif /* CONFIG_WPS */
340}
341
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700342
343void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
344 struct wpa_ssid *ssid)
345{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800346 if (wpa_s->p2p_mgmt)
347 return;
348
Jouni Malinen75ecf522011-06-27 15:19:46 -0700349 /*
350 * Networks objects created during any P2P activities should not be
351 * exposed out. They might/will confuse certain non-P2P aware
352 * applications since these network objects won't behave like
353 * regular ones.
354 */
Roshan Piusd3854452016-07-07 16:46:41 -0700355 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700356 wpas_dbus_register_network(wpa_s, ssid);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700357 wpas_hidl_register_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700358 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700359}
360
361
362void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
363 struct wpa_ssid *ssid)
364{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700365#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700366 wpas_dbus_register_persistent_group(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700367#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700368}
369
370
371void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
372 struct wpa_ssid *ssid)
373{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700374#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700375 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700376#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700377}
378
379
380void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
381 struct wpa_ssid *ssid)
382{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800383 if (wpa_s->next_ssid == ssid)
384 wpa_s->next_ssid = NULL;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800385 if (wpa_s->wpa)
386 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700387 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700388 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700389 wpas_dbus_unregister_network(wpa_s, ssid->id);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700390 wpas_hidl_unregister_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700391 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800392 if (network_is_persistent_group(ssid))
393 wpas_notify_persistent_group_removed(wpa_s, ssid);
394
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800395 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700396}
397
398
399void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
400 u8 bssid[], unsigned int id)
401{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800402 if (wpa_s->p2p_mgmt)
403 return;
404
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700405 wpas_dbus_register_bss(wpa_s, bssid, id);
406 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
407 id, MAC2STR(bssid));
408}
409
410
411void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
412 u8 bssid[], unsigned int id)
413{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800414 if (wpa_s->p2p_mgmt)
415 return;
416
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700417 wpas_dbus_unregister_bss(wpa_s, bssid, id);
418 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
419 id, MAC2STR(bssid));
420}
421
422
423void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
424 unsigned int id)
425{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800426 if (wpa_s->p2p_mgmt)
427 return;
428
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700429 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
430}
431
432
433void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
434 unsigned int id)
435{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800436 if (wpa_s->p2p_mgmt)
437 return;
438
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700439 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
440 id);
441}
442
443
444void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
445 unsigned int id)
446{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800447 if (wpa_s->p2p_mgmt)
448 return;
449
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700450 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
451 id);
452}
453
454
455void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
456 unsigned int id)
457{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800458 if (wpa_s->p2p_mgmt)
459 return;
460
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700461 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
462}
463
464
465void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
466 unsigned int id)
467{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800468 if (wpa_s->p2p_mgmt)
469 return;
470
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700471 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
472}
473
474
475void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
476 unsigned int id)
477{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800478 if (wpa_s->p2p_mgmt)
479 return;
480
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700481 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
482}
483
484
485void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
486 unsigned int id)
487{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800488 if (wpa_s->p2p_mgmt)
489 return;
490
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800491#ifdef CONFIG_WPS
492 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
493#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700494}
495
496
497void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
498 unsigned int id)
499{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800500 if (wpa_s->p2p_mgmt)
501 return;
502
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700503 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
504}
505
506
507void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
508 unsigned int id)
509{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800510 if (wpa_s->p2p_mgmt)
511 return;
512
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700513 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
514}
515
516
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700517void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
518{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800519 if (wpa_s->p2p_mgmt)
520 return;
521
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700522 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
523}
524
525
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700526void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
527{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800528 if (wpa_s->p2p_mgmt)
529 return;
530
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700531 wpas_dbus_signal_blob_added(wpa_s, name);
532}
533
534
535void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
536{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800537 if (wpa_s->p2p_mgmt)
538 return;
539
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700540 wpas_dbus_signal_blob_removed(wpa_s, name);
541}
542
543
544void wpas_notify_debug_level_changed(struct wpa_global *global)
545{
546 wpas_dbus_signal_debug_level_changed(global);
547}
548
549
550void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
551{
552 wpas_dbus_signal_debug_timestamp_changed(global);
553}
554
555
556void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
557{
558 wpas_dbus_signal_debug_show_keys_changed(global);
559}
560
561
562void wpas_notify_suspend(struct wpa_global *global)
563{
564 struct wpa_supplicant *wpa_s;
565
566 os_get_time(&global->suspend_time);
567 wpa_printf(MSG_DEBUG, "System suspend notification");
568 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
569 wpa_drv_suspend(wpa_s);
570}
571
572
573void wpas_notify_resume(struct wpa_global *global)
574{
575 struct os_time now;
576 int slept;
577 struct wpa_supplicant *wpa_s;
578
579 if (global->suspend_time.sec == 0)
580 slept = -1;
581 else {
582 os_get_time(&now);
583 slept = now.sec - global->suspend_time.sec;
584 }
585 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
586 slept);
587
588 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
589 wpa_drv_resume(wpa_s);
590 if (wpa_s->wpa_state == WPA_DISCONNECTED)
591 wpa_supplicant_req_scan(wpa_s, 0, 100000);
592 }
593}
594
595
596#ifdef CONFIG_P2P
597
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700598void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
599{
600 /* Notify P2P find has stopped */
601 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800602
603 wpas_hidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700604}
605
606
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700607void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800608 const u8 *addr, const struct p2p_peer_info *info,
609 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
610 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700611{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700612 if (new_device) {
613 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800614 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700615 }
616
617 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800618 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
619
620 wpas_hidl_notify_p2p_device_found(wpa_s, addr, info,
621 peer_wfd_device_info,
622 peer_wfd_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700623}
624
625
626void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
627 const u8 *dev_addr)
628{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700629 wpas_dbus_unregister_peer(wpa_s, dev_addr);
630
631 /* Create signal on interface object*/
632 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800633
634 wpas_hidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700635}
636
637
638void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
639 const struct wpa_ssid *ssid,
640 const char *role)
641{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700642 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700643
644 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800645
646 wpas_hidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700647}
648
649
650void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700651 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700652{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700653 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800654
655 wpas_hidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700656}
657
658
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800659void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
660 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700661{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800662 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800663
664 wpas_hidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700665}
666
667
668void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
669 int status, const u8 *bssid)
670{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700671 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800672
673 wpas_hidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700674}
675
676
677void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
678 int freq, const u8 *sa, u8 dialog_token,
679 u16 update_indic, const u8 *tlvs,
680 size_t tlvs_len)
681{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700682 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
683 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700684}
685
686
687void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
688 const u8 *sa, u16 update_indic,
689 const u8 *tlvs, size_t tlvs_len)
690{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700691 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
692 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800693
694 wpas_hidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
695 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700696}
697
698
699/**
700 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
701 * @dev_addr: Who sent the request or responded to our request.
702 * @request: Will be 1 if request, 0 for response.
703 * @status: Valid only in case of response (0 in case of success)
704 * @config_methods: WPS config methods
705 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
706 *
707 * This can be used to notify:
708 * - Requests or responses
709 * - Various config methods
710 * - Failure condition in case of response
711 */
712void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
713 const u8 *dev_addr, int request,
714 enum p2p_prov_disc_status status,
715 u16 config_methods,
716 unsigned int generated_pin)
717{
718 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
719 status, config_methods,
720 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800721
722 wpas_hidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
723 status, config_methods,
724 generated_pin);
725
Jouni Malinen75ecf522011-06-27 15:19:46 -0700726}
727
728
729void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700730 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800731 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700732{
733 /* Notify a group has been started */
734 wpas_dbus_register_p2p_group(wpa_s, ssid);
735
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800736 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800737
738 wpas_hidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700739}
740
741
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800742void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
743 const char *reason)
744{
745 /* Notify a group formation failed */
746 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800747
748 wpas_hidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800749}
750
751
Jouni Malinen75ecf522011-06-27 15:19:46 -0700752void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
753 struct wps_event_fail *fail)
754{
755 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700756}
757
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800758
759void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
760 const u8 *sa, const u8 *go_dev_addr,
761 const u8 *bssid, int id, int op_freq)
762{
763 /* Notify a P2P Invitation Request */
764 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
765 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800766
767 wpas_hidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
768 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800769}
770
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700771#endif /* CONFIG_P2P */
772
773
774static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800775 const u8 *sta,
776 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700777{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700778#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800779 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
780
Jouni Malinen75ecf522011-06-27 15:19:46 -0700781 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700782 * Create 'peer-joined' signal on group object -- will also
783 * check P2P itself.
784 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800785 if (p2p_dev_addr)
786 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700787#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700788
789 /* Notify listeners a new station has been authorized */
790 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800791
792 wpas_hidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700793}
794
795
796static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700797 const u8 *sta,
798 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700799{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700800#ifdef CONFIG_P2P
801 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700802 * Create 'peer-disconnected' signal on group object if this
803 * is a P2P group.
804 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800805 if (p2p_dev_addr)
806 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700807#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700808
809 /* Notify listeners a station has been deauthorized */
810 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800811
812 wpas_hidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700813}
814
815
816void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800817 const u8 *mac_addr, int authorized,
818 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700819{
820 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800821 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700822 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700823 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700824}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700825
826
827void wpas_notify_certification(struct wpa_supplicant *wpa_s, int depth,
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800828 const char *subject, const char *altsubject[],
829 int num_altsubject, const char *cert_hash,
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700830 const struct wpabuf *cert)
831{
832 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
833 "depth=%d subject='%s'%s%s",
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800834 depth, subject, cert_hash ? " hash=" : "",
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700835 cert_hash ? cert_hash : "");
836
837 if (cert) {
838 char *cert_hex;
839 size_t len = wpabuf_len(cert) * 2 + 1;
840 cert_hex = os_malloc(len);
841 if (cert_hex) {
842 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert),
843 wpabuf_len(cert));
844 wpa_msg_ctrl(wpa_s, MSG_INFO,
845 WPA_EVENT_EAP_PEER_CERT
846 "depth=%d subject='%s' cert=%s",
847 depth, subject, cert_hex);
848 os_free(cert_hex);
849 }
850 }
851
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800852 if (altsubject) {
853 int i;
854
855 for (i = 0; i < num_altsubject; i++)
856 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
857 "depth=%d %s", depth, altsubject[i]);
858 }
859
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700860 /* notify the old DBus API */
861 wpa_supplicant_dbus_notify_certification(wpa_s, depth, subject,
862 cert_hash, cert);
863 /* notify the new DBus API */
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800864 wpas_dbus_signal_certification(wpa_s, depth, subject, altsubject,
865 num_altsubject, cert_hash, cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700866}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700867
868
869void wpas_notify_preq(struct wpa_supplicant *wpa_s,
870 const u8 *addr, const u8 *dst, const u8 *bssid,
871 const u8 *ie, size_t ie_len, u32 ssi_signal)
872{
873#ifdef CONFIG_AP
874 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
875#endif /* CONFIG_AP */
876}
877
878
879void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
880 const char *parameter)
881{
882 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700883 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
884 "status='%s' parameter='%s'",
885 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700886}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700887
888
889void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
890 struct wpa_ssid *ssid)
891{
892 if (wpa_s->current_ssid != ssid)
893 return;
894
895 wpa_dbg(wpa_s, MSG_DEBUG,
896 "Network bssid config changed for the current network - within-ESS roaming %s",
897 ssid->bssid_set ? "disabled" : "enabled");
898
899 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
900 ssid->bssid_set ? ssid->bssid : NULL);
901}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800902
903
904void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
905 struct wpa_ssid *ssid)
906{
907#ifdef CONFIG_P2P
908 if (ssid->disabled == 2) {
909 /* Changed from normal network profile to persistent group */
910 ssid->disabled = 0;
911 wpas_dbus_unregister_network(wpa_s, ssid->id);
912 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700913 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800914 wpas_dbus_register_persistent_group(wpa_s, ssid);
915 } else {
916 /* Changed from persistent group to normal network profile */
917 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700918 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800919 wpas_dbus_register_network(wpa_s, ssid);
920 }
921#endif /* CONFIG_P2P */
922}
Roshan Pius04a9d742016-12-12 12:40:46 -0800923
924void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
925 const char *result,
926 const struct wpa_bss_anqp *anqp)
927{
928#ifdef CONFIG_INTERWORKING
929 if (!wpa_s || !bssid || !anqp)
930 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800931
932 wpas_hidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -0800933#endif /* CONFIG_INTERWORKING */
934}
935
936void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
937 const char* file_name, const u8* image,
938 u32 image_length)
939{
940#ifdef CONFIG_HS20
941 if (!wpa_s || !bssid || !file_name || !image)
942 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800943
944 wpas_hidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
945 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -0800946#endif /* CONFIG_HS20 */
947}
948
949void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
950 const char* url,
951 u8 osu_method)
952{
953#ifdef CONFIG_HS20
954 if (!wpa_s || !url)
955 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800956
957 wpas_hidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -0800958#endif /* CONFIG_HS20 */
959}
960
961void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
962 u8 code, u16 reauth_delay,
963 const char *url)
964{
965#ifdef CONFIG_HS20
966 if (!wpa_s || !url)
967 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800968
969 wpas_hidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
970 url);
Roshan Pius04a9d742016-12-12 12:40:46 -0800971#endif /* CONFIG_HS20 */
972}