blob: 2f163ac4de7097ec0e3a8591f45def8472bf030e [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);
193}
194
195
196void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
197{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800198 if (wpa_s->p2p_mgmt)
199 return;
200
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700201 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
202}
203
204
205void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
206 struct wpa_ssid *ssid)
207{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800208 if (wpa_s->p2p_mgmt)
209 return;
210
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700211 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
212}
213
214
215void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
216 struct wpa_ssid *ssid)
217{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800218 if (wpa_s->p2p_mgmt)
219 return;
220
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700221 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
222}
223
224
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800225void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
226 struct wpa_ssid *ssid,
227 enum wpa_ctrl_req_type rtype,
228 const char *default_txt)
229{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800230 if (wpa_s->p2p_mgmt)
231 return;
232
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800233 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700234
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700235 wpas_hidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800236}
237
238
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700239void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
240{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800241 if (wpa_s->p2p_mgmt)
242 return;
243
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700244 /* notify the old DBus API */
245 wpa_supplicant_dbus_notify_scanning(wpa_s);
246
247 /* notify the new DBus API */
248 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
249}
250
251
252void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
253{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800254 if (wpa_s->p2p_mgmt)
255 return;
256
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700257 wpas_dbus_signal_scan_done(wpa_s, success);
258}
259
260
261void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
262{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800263 if (wpa_s->p2p_mgmt)
264 return;
265
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700266 /* notify the old DBus API */
267 wpa_supplicant_dbus_notify_scan_results(wpa_s);
268
269 wpas_wps_notify_scan_results(wpa_s);
270}
271
272
273void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
274 const struct wps_credential *cred)
275{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800276 if (wpa_s->p2p_mgmt)
277 return;
278
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700279#ifdef CONFIG_WPS
280 /* notify the old DBus API */
281 wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
282 /* notify the new DBus API */
283 wpas_dbus_signal_wps_cred(wpa_s, cred);
284#endif /* CONFIG_WPS */
285}
286
287
288void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
289 struct wps_event_m2d *m2d)
290{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800291 if (wpa_s->p2p_mgmt)
292 return;
293
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700294#ifdef CONFIG_WPS
295 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
296#endif /* CONFIG_WPS */
297}
298
299
300void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
301 struct wps_event_fail *fail)
302{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800303 if (wpa_s->p2p_mgmt)
304 return;
305
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700306#ifdef CONFIG_WPS
307 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800308
309 wpas_hidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
310 fail->config_error,
311 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700312#endif /* CONFIG_WPS */
313}
314
315
316void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
317{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800318 if (wpa_s->p2p_mgmt)
319 return;
320
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700321#ifdef CONFIG_WPS
322 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800323
324 wpas_hidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700325#endif /* CONFIG_WPS */
326}
327
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700328void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
329{
330 if (wpa_s->p2p_mgmt)
331 return;
332
333#ifdef CONFIG_WPS
334 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800335
336 wpas_hidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700337#endif /* CONFIG_WPS */
338}
339
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700340
341void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
342 struct wpa_ssid *ssid)
343{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800344 if (wpa_s->p2p_mgmt)
345 return;
346
Jouni Malinen75ecf522011-06-27 15:19:46 -0700347 /*
348 * Networks objects created during any P2P activities should not be
349 * exposed out. They might/will confuse certain non-P2P aware
350 * applications since these network objects won't behave like
351 * regular ones.
352 */
Roshan Piusd3854452016-07-07 16:46:41 -0700353 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700354 wpas_dbus_register_network(wpa_s, ssid);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700355 wpas_hidl_register_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700356 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700357}
358
359
360void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
361 struct wpa_ssid *ssid)
362{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700363#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700364 wpas_dbus_register_persistent_group(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700365#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700366}
367
368
369void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
370 struct wpa_ssid *ssid)
371{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700372#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700373 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700374#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700375}
376
377
378void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
379 struct wpa_ssid *ssid)
380{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800381 if (wpa_s->next_ssid == ssid)
382 wpa_s->next_ssid = NULL;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800383 if (wpa_s->wpa)
384 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700385 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700386 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700387 wpas_dbus_unregister_network(wpa_s, ssid->id);
Roshan Pius57ffbcf2016-09-27 09:12:46 -0700388 wpas_hidl_unregister_network(wpa_s, ssid);
Roshan Piusd3854452016-07-07 16:46:41 -0700389 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800390 if (network_is_persistent_group(ssid))
391 wpas_notify_persistent_group_removed(wpa_s, ssid);
392
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800393 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700394}
395
396
397void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
398 u8 bssid[], unsigned int id)
399{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800400 if (wpa_s->p2p_mgmt)
401 return;
402
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700403 wpas_dbus_register_bss(wpa_s, bssid, id);
404 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
405 id, MAC2STR(bssid));
406}
407
408
409void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
410 u8 bssid[], unsigned int id)
411{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800412 if (wpa_s->p2p_mgmt)
413 return;
414
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700415 wpas_dbus_unregister_bss(wpa_s, bssid, id);
416 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
417 id, MAC2STR(bssid));
418}
419
420
421void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
422 unsigned int id)
423{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800424 if (wpa_s->p2p_mgmt)
425 return;
426
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700427 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
428}
429
430
431void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
432 unsigned int id)
433{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800434 if (wpa_s->p2p_mgmt)
435 return;
436
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700437 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
438 id);
439}
440
441
442void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
443 unsigned int id)
444{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800445 if (wpa_s->p2p_mgmt)
446 return;
447
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700448 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
449 id);
450}
451
452
453void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
454 unsigned int id)
455{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800456 if (wpa_s->p2p_mgmt)
457 return;
458
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700459 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
460}
461
462
463void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
464 unsigned int id)
465{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800466 if (wpa_s->p2p_mgmt)
467 return;
468
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700469 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
470}
471
472
473void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
474 unsigned int id)
475{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800476 if (wpa_s->p2p_mgmt)
477 return;
478
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700479 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
480}
481
482
483void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
484 unsigned int id)
485{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800486 if (wpa_s->p2p_mgmt)
487 return;
488
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800489#ifdef CONFIG_WPS
490 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
491#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700492}
493
494
495void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
496 unsigned int id)
497{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800498 if (wpa_s->p2p_mgmt)
499 return;
500
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700501 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
502}
503
504
505void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
506 unsigned int id)
507{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800508 if (wpa_s->p2p_mgmt)
509 return;
510
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700511 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
512}
513
514
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700515void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
516{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800517 if (wpa_s->p2p_mgmt)
518 return;
519
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700520 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
521}
522
523
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700524void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
525{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800526 if (wpa_s->p2p_mgmt)
527 return;
528
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700529 wpas_dbus_signal_blob_added(wpa_s, name);
530}
531
532
533void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
534{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800535 if (wpa_s->p2p_mgmt)
536 return;
537
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700538 wpas_dbus_signal_blob_removed(wpa_s, name);
539}
540
541
542void wpas_notify_debug_level_changed(struct wpa_global *global)
543{
544 wpas_dbus_signal_debug_level_changed(global);
545}
546
547
548void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
549{
550 wpas_dbus_signal_debug_timestamp_changed(global);
551}
552
553
554void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
555{
556 wpas_dbus_signal_debug_show_keys_changed(global);
557}
558
559
560void wpas_notify_suspend(struct wpa_global *global)
561{
562 struct wpa_supplicant *wpa_s;
563
564 os_get_time(&global->suspend_time);
565 wpa_printf(MSG_DEBUG, "System suspend notification");
566 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
567 wpa_drv_suspend(wpa_s);
568}
569
570
571void wpas_notify_resume(struct wpa_global *global)
572{
573 struct os_time now;
574 int slept;
575 struct wpa_supplicant *wpa_s;
576
577 if (global->suspend_time.sec == 0)
578 slept = -1;
579 else {
580 os_get_time(&now);
581 slept = now.sec - global->suspend_time.sec;
582 }
583 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
584 slept);
585
586 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
587 wpa_drv_resume(wpa_s);
588 if (wpa_s->wpa_state == WPA_DISCONNECTED)
589 wpa_supplicant_req_scan(wpa_s, 0, 100000);
590 }
591}
592
593
594#ifdef CONFIG_P2P
595
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700596void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
597{
598 /* Notify P2P find has stopped */
599 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800600
601 wpas_hidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700602}
603
604
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700605void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800606 const u8 *addr, const struct p2p_peer_info *info,
607 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
608 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700609{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700610 if (new_device) {
611 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800612 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700613 }
614
615 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800616 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
617
618 wpas_hidl_notify_p2p_device_found(wpa_s, addr, info,
619 peer_wfd_device_info,
620 peer_wfd_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700621}
622
623
624void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
625 const u8 *dev_addr)
626{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700627 wpas_dbus_unregister_peer(wpa_s, dev_addr);
628
629 /* Create signal on interface object*/
630 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800631
632 wpas_hidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700633}
634
635
636void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
637 const struct wpa_ssid *ssid,
638 const char *role)
639{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700640 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700641
642 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800643
644 wpas_hidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700645}
646
647
648void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700649 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700650{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700651 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800652
653 wpas_hidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700654}
655
656
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800657void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
658 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700659{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800660 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800661
662 wpas_hidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700663}
664
665
666void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
667 int status, const u8 *bssid)
668{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700669 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800670
671 wpas_hidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700672}
673
674
675void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
676 int freq, const u8 *sa, u8 dialog_token,
677 u16 update_indic, const u8 *tlvs,
678 size_t tlvs_len)
679{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700680 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
681 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700682}
683
684
685void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
686 const u8 *sa, u16 update_indic,
687 const u8 *tlvs, size_t tlvs_len)
688{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700689 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
690 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800691
692 wpas_hidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
693 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700694}
695
696
697/**
698 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
699 * @dev_addr: Who sent the request or responded to our request.
700 * @request: Will be 1 if request, 0 for response.
701 * @status: Valid only in case of response (0 in case of success)
702 * @config_methods: WPS config methods
703 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
704 *
705 * This can be used to notify:
706 * - Requests or responses
707 * - Various config methods
708 * - Failure condition in case of response
709 */
710void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
711 const u8 *dev_addr, int request,
712 enum p2p_prov_disc_status status,
713 u16 config_methods,
714 unsigned int generated_pin)
715{
716 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
717 status, config_methods,
718 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800719
720 wpas_hidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
721 status, config_methods,
722 generated_pin);
723
Jouni Malinen75ecf522011-06-27 15:19:46 -0700724}
725
726
727void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700728 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800729 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700730{
731 /* Notify a group has been started */
732 wpas_dbus_register_p2p_group(wpa_s, ssid);
733
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800734 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800735
736 wpas_hidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700737}
738
739
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800740void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
741 const char *reason)
742{
743 /* Notify a group formation failed */
744 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800745
746 wpas_hidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800747}
748
749
Jouni Malinen75ecf522011-06-27 15:19:46 -0700750void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
751 struct wps_event_fail *fail)
752{
753 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700754}
755
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800756
757void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
758 const u8 *sa, const u8 *go_dev_addr,
759 const u8 *bssid, int id, int op_freq)
760{
761 /* Notify a P2P Invitation Request */
762 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
763 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800764
765 wpas_hidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
766 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800767}
768
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700769#endif /* CONFIG_P2P */
770
771
772static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800773 const u8 *sta,
774 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700775{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700776#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800777 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
778
Jouni Malinen75ecf522011-06-27 15:19:46 -0700779 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700780 * Create 'peer-joined' signal on group object -- will also
781 * check P2P itself.
782 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800783 if (p2p_dev_addr)
784 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700785#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700786
787 /* Notify listeners a new station has been authorized */
788 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800789
790 wpas_hidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700791}
792
793
794static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700795 const u8 *sta,
796 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700797{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700798#ifdef CONFIG_P2P
799 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700800 * Create 'peer-disconnected' signal on group object if this
801 * is a P2P group.
802 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800803 if (p2p_dev_addr)
804 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700805#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700806
807 /* Notify listeners a station has been deauthorized */
808 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800809
810 wpas_hidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700811}
812
813
814void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800815 const u8 *mac_addr, int authorized,
816 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700817{
818 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800819 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700820 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700821 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700822}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700823
824
825void wpas_notify_certification(struct wpa_supplicant *wpa_s, int depth,
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800826 const char *subject, const char *altsubject[],
827 int num_altsubject, const char *cert_hash,
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700828 const struct wpabuf *cert)
829{
830 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
831 "depth=%d subject='%s'%s%s",
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800832 depth, subject, cert_hash ? " hash=" : "",
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700833 cert_hash ? cert_hash : "");
834
835 if (cert) {
836 char *cert_hex;
837 size_t len = wpabuf_len(cert) * 2 + 1;
838 cert_hex = os_malloc(len);
839 if (cert_hex) {
840 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert),
841 wpabuf_len(cert));
842 wpa_msg_ctrl(wpa_s, MSG_INFO,
843 WPA_EVENT_EAP_PEER_CERT
844 "depth=%d subject='%s' cert=%s",
845 depth, subject, cert_hex);
846 os_free(cert_hex);
847 }
848 }
849
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800850 if (altsubject) {
851 int i;
852
853 for (i = 0; i < num_altsubject; i++)
854 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
855 "depth=%d %s", depth, altsubject[i]);
856 }
857
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700858 /* notify the old DBus API */
859 wpa_supplicant_dbus_notify_certification(wpa_s, depth, subject,
860 cert_hash, cert);
861 /* notify the new DBus API */
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800862 wpas_dbus_signal_certification(wpa_s, depth, subject, altsubject,
863 num_altsubject, cert_hash, cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700864}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700865
866
867void wpas_notify_preq(struct wpa_supplicant *wpa_s,
868 const u8 *addr, const u8 *dst, const u8 *bssid,
869 const u8 *ie, size_t ie_len, u32 ssi_signal)
870{
871#ifdef CONFIG_AP
872 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
873#endif /* CONFIG_AP */
874}
875
876
877void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
878 const char *parameter)
879{
880 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700881 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
882 "status='%s' parameter='%s'",
883 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700884}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700885
886
887void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
888 struct wpa_ssid *ssid)
889{
890 if (wpa_s->current_ssid != ssid)
891 return;
892
893 wpa_dbg(wpa_s, MSG_DEBUG,
894 "Network bssid config changed for the current network - within-ESS roaming %s",
895 ssid->bssid_set ? "disabled" : "enabled");
896
897 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
898 ssid->bssid_set ? ssid->bssid : NULL);
899}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800900
901
902void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
903 struct wpa_ssid *ssid)
904{
905#ifdef CONFIG_P2P
906 if (ssid->disabled == 2) {
907 /* Changed from normal network profile to persistent group */
908 ssid->disabled = 0;
909 wpas_dbus_unregister_network(wpa_s, ssid->id);
910 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700911 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800912 wpas_dbus_register_persistent_group(wpa_s, ssid);
913 } else {
914 /* Changed from persistent group to normal network profile */
915 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700916 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800917 wpas_dbus_register_network(wpa_s, ssid);
918 }
919#endif /* CONFIG_P2P */
920}
Roshan Pius04a9d742016-12-12 12:40:46 -0800921
922void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
923 const char *result,
924 const struct wpa_bss_anqp *anqp)
925{
926#ifdef CONFIG_INTERWORKING
927 if (!wpa_s || !bssid || !anqp)
928 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800929
930 wpas_hidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -0800931#endif /* CONFIG_INTERWORKING */
932}
933
934void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
935 const char* file_name, const u8* image,
936 u32 image_length)
937{
938#ifdef CONFIG_HS20
939 if (!wpa_s || !bssid || !file_name || !image)
940 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800941
942 wpas_hidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
943 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -0800944#endif /* CONFIG_HS20 */
945}
946
947void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
948 const char* url,
949 u8 osu_method)
950{
951#ifdef CONFIG_HS20
952 if (!wpa_s || !url)
953 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800954
955 wpas_hidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -0800956#endif /* CONFIG_HS20 */
957}
958
959void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
960 u8 code, u16 reauth_delay,
961 const char *url)
962{
963#ifdef CONFIG_HS20
964 if (!wpa_s || !url)
965 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800966
967 wpas_hidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
968 url);
Roshan Pius04a9d742016-12-12 12:40:46 -0800969#endif /* CONFIG_HS20 */
970}