2 * wpa_supplicant - Event notifications
3 * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #include "utils/includes.h"
17 #include "utils/common.h"
18 #include "common/wpa_ctrl.h"
20 #include "wpa_supplicant_i.h"
21 #include "wps_supplicant.h"
22 #include "dbus/dbus_common.h"
23 #include "dbus/dbus_old.h"
24 #include "dbus/dbus_new.h"
27 int wpas_notify_supplicant_initialized(struct wpa_global *global)
30 if (global->params.dbus_ctrl_interface) {
31 global->dbus = wpas_dbus_init(global);
32 if (global->dbus == NULL)
35 #endif /* CONFIG_DBUS */
41 void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
45 wpas_dbus_deinit(global->dbus);
46 #endif /* CONFIG_DBUS */
50 int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
52 if (wpas_dbus_register_iface(wpa_s))
55 if (wpas_dbus_register_interface(wpa_s))
62 void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
64 /* unregister interface in old DBus ctrl iface */
65 wpas_dbus_unregister_iface(wpa_s);
67 /* unregister interface in new DBus ctrl iface */
68 wpas_dbus_unregister_interface(wpa_s);
72 void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
73 enum wpa_states new_state,
74 enum wpa_states old_state)
76 /* notify the old DBus API */
77 wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
80 /* notify the new DBus API */
81 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
85 void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
87 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
91 void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
93 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
97 void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
99 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
103 void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
104 struct wpa_ssid *ssid)
106 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
110 void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
111 struct wpa_ssid *ssid)
113 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
117 void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
119 /* notify the old DBus API */
120 wpa_supplicant_dbus_notify_scanning(wpa_s);
122 /* notify the new DBus API */
123 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
127 void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
129 wpas_dbus_signal_scan_done(wpa_s, success);
133 void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
135 /* notify the old DBus API */
136 wpa_supplicant_dbus_notify_scan_results(wpa_s);
138 wpas_wps_notify_scan_results(wpa_s);
142 void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
143 const struct wps_credential *cred)
146 /* notify the old DBus API */
147 wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
148 /* notify the new DBus API */
149 wpas_dbus_signal_wps_cred(wpa_s, cred);
150 #endif /* CONFIG_WPS */
154 void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
155 struct wps_event_m2d *m2d)
158 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
159 #endif /* CONFIG_WPS */
163 void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
164 struct wps_event_fail *fail)
167 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
168 #endif /* CONFIG_WPS */
172 void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
175 wpas_dbus_signal_wps_event_success(wpa_s);
176 #endif /* CONFIG_WPS */
180 void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
181 struct wpa_ssid *ssid)
183 wpas_dbus_register_network(wpa_s, ssid);
187 void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
188 struct wpa_ssid *ssid)
190 wpas_dbus_unregister_network(wpa_s, ssid->id);
194 void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
195 u8 bssid[], unsigned int id)
197 wpas_dbus_register_bss(wpa_s, bssid, id);
198 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
203 void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
204 u8 bssid[], unsigned int id)
206 wpas_dbus_unregister_bss(wpa_s, bssid, id);
207 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
212 void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
215 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
219 void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
222 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
227 void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
230 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
235 void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
238 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
242 void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
245 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
249 void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
252 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
256 void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
262 void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
265 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
269 void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
272 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
276 void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
278 wpas_dbus_signal_blob_added(wpa_s, name);
282 void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
284 wpas_dbus_signal_blob_removed(wpa_s, name);
288 void wpas_notify_debug_level_changed(struct wpa_global *global)
290 wpas_dbus_signal_debug_level_changed(global);
294 void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
296 wpas_dbus_signal_debug_timestamp_changed(global);
300 void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
302 wpas_dbus_signal_debug_show_keys_changed(global);