2 * WPA Supplicant / dbus-based control interface
3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
4 * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Alternatively, this software may be distributed under the terms of BSD
13 * See README and COPYING for more details.
16 #ifndef CTRL_IFACE_DBUS_NEW_H
17 #define CTRL_IFACE_DBUS_NEW_H
20 struct wpa_supplicant
;
23 struct wps_event_fail
;
24 struct wps_credential
;
28 WPAS_DBUS_PROP_AP_SCAN
,
29 WPAS_DBUS_PROP_SCANNING
,
30 WPAS_DBUS_PROP_CURRENT_BSS
,
31 WPAS_DBUS_PROP_CURRENT_NETWORK
,
34 #define WPAS_DBUS_OBJECT_PATH_MAX 150
36 #define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1"
37 #define WPAS_DBUS_NEW_PATH "/fi/w1/wpa_supplicant1"
38 #define WPAS_DBUS_NEW_INTERFACE "fi.w1.wpa_supplicant1"
40 #define WPAS_DBUS_NEW_PATH_INTERFACES WPAS_DBUS_NEW_PATH "/Interfaces"
41 #define WPAS_DBUS_NEW_IFACE_INTERFACE WPAS_DBUS_NEW_INTERFACE ".Interface"
42 #define WPAS_DBUS_NEW_IFACE_WPS WPAS_DBUS_NEW_IFACE_INTERFACE ".WPS"
44 #define WPAS_DBUS_NEW_NETWORKS_PART "Networks"
45 #define WPAS_DBUS_NEW_IFACE_NETWORK WPAS_DBUS_NEW_IFACE_INTERFACE ".Network"
47 #define WPAS_DBUS_NEW_BSSIDS_PART "BSSs"
48 #define WPAS_DBUS_NEW_IFACE_BSSID WPAS_DBUS_NEW_IFACE_INTERFACE ".BSS"
52 #define WPAS_DBUS_ERROR_UNKNOWN_ERROR \
53 WPAS_DBUS_NEW_INTERFACE ".UnknownError"
54 #define WPAS_DBUS_ERROR_INVALID_ARGS \
55 WPAS_DBUS_NEW_INTERFACE ".InvalidArgs"
57 #define WPAS_DBUS_ERROR_IFACE_EXISTS \
58 WPAS_DBUS_NEW_INTERFACE ".InterfaceExists"
59 #define WPAS_DBUS_ERROR_IFACE_UNKNOWN \
60 WPAS_DBUS_NEW_INTERFACE ".InterfaceUnknown"
62 #define WPAS_DBUS_ERROR_NOT_CONNECTED \
63 WPAS_DBUS_NEW_IFACE_INTERFACE ".NotConnected"
64 #define WPAS_DBUS_ERROR_NETWORK_UNKNOWN \
65 WPAS_DBUS_NEW_IFACE_INTERFACE ".NetworkUnknown"
67 #define WPAS_DBUS_ERROR_BLOB_EXISTS \
68 WPAS_DBUS_NEW_IFACE_INTERFACE ".BlobExists"
69 #define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
70 WPAS_DBUS_NEW_IFACE_INTERFACE ".BlobUnknown"
73 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
75 int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv
*priv
);
76 void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv
*iface
);
78 int wpas_dbus_register_interface(struct wpa_supplicant
*wpa_s
);
79 int wpas_dbus_unregister_interface(struct wpa_supplicant
*wpa_s
);
80 void wpas_dbus_signal_state_changed(struct wpa_supplicant
*wpa_s
,
81 enum wpa_states new_state
,
82 enum wpa_states old_state
);
83 void wpas_dbus_signal_prop_changed(struct wpa_supplicant
*wpa_s
,
84 enum wpas_dbus_prop property
);
85 void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant
*wpa_s
,
86 struct wpa_ssid
*ssid
);
87 void wpas_dbus_signal_network_selected(struct wpa_supplicant
*wpa_s
, int id
);
88 void wpas_dbus_signal_scan_done(struct wpa_supplicant
*wpa_s
, int success
);
89 void wpas_dbus_signal_wps_cred(struct wpa_supplicant
*wpa_s
,
90 const struct wps_credential
*cred
);
91 void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant
*wpa_s
,
92 struct wps_event_m2d
*m2d
);
93 void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant
*wpa_s
,
94 struct wps_event_fail
*fail
);
95 void wpas_dbus_signal_wps_event_success(struct wpa_supplicant
*wpa_s
);
96 int wpas_dbus_register_network(struct wpa_supplicant
*wpa_s
,
97 struct wpa_ssid
*ssid
);
98 int wpas_dbus_unregister_network(struct wpa_supplicant
*wpa_s
, int nid
);
99 int wpas_dbus_unregister_bss(struct wpa_supplicant
*wpa_s
,
100 u8 bssid
[ETH_ALEN
], unsigned int id
);
101 int wpas_dbus_register_bss(struct wpa_supplicant
*wpa_s
,
102 u8 bssid
[ETH_ALEN
], unsigned int id
);
103 void wpas_dbus_signal_blob_added(struct wpa_supplicant
*wpa_s
,
105 void wpas_dbus_signal_blob_removed(struct wpa_supplicant
*wpa_s
,
107 void wpas_dbus_signal_debug_level_changed(struct wpa_global
*global
);
108 void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global
*global
);
109 void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global
*global
);
111 #else /* CONFIG_CTRL_IFACE_DBUS_NEW */
113 static inline int wpas_dbus_register_interface(struct wpa_supplicant
*wpa_s
)
118 static inline int wpas_dbus_unregister_interface(struct wpa_supplicant
*wpa_s
)
123 #define wpas_dbus_signal_state_changed(w, n, o) do { } while (0)
125 static inline void wpas_dbus_signal_prop_changed(struct wpa_supplicant
*wpa_s
,
126 enum wpas_dbus_prop property
)
130 static inline void wpas_dbus_signal_network_enabled_changed(
131 struct wpa_supplicant
*wpa_s
, struct wpa_ssid
*ssid
)
135 static inline void wpas_dbus_signal_network_selected(
136 struct wpa_supplicant
*wpa_s
, int id
)
140 static inline void wpas_dbus_signal_scan_done(struct wpa_supplicant
*wpa_s
,
145 static inline void wpas_dbus_signal_wps_cred(struct wpa_supplicant
*wpa_s
,
146 const struct wps_credential
*cred
)
150 static inline void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant
*wpa_s
,
151 struct wps_event_m2d
*m2d
)
155 static inline void wpas_dbus_signal_wps_event_fail(
156 struct wpa_supplicant
*wpa_s
, struct wps_event_fail
*fail
)
160 static inline void wpas_dbus_signal_wps_event_success(
161 struct wpa_supplicant
*wpa_s
)
165 static inline int wpas_dbus_register_network(struct wpa_supplicant
*wpa_s
,
166 struct wpa_ssid
*ssid
)
171 static inline int wpas_dbus_unregister_network(struct wpa_supplicant
*wpa_s
,
177 static inline int wpas_dbus_unregister_bss(struct wpa_supplicant
*wpa_s
,
178 u8 bssid
[ETH_ALEN
], unsigned int id
)
183 static inline int wpas_dbus_register_bss(struct wpa_supplicant
*wpa_s
,
184 u8 bssid
[ETH_ALEN
], unsigned int id
)
189 static inline void wpas_dbus_signal_blob_added(struct wpa_supplicant
*wpa_s
,
194 static inline void wpas_dbus_signal_blob_removed(struct wpa_supplicant
*wpa_s
,
199 static inline void wpas_dbus_signal_debug_level_changed(
200 struct wpa_global
*global
)
204 static inline void wpas_dbus_signal_debug_timestamp_changed(
205 struct wpa_global
*global
)
209 static inline void wpas_dbus_signal_debug_show_keys_changed(
210 struct wpa_global
*global
)
214 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
216 #endif /* CTRL_IFACE_DBUS_H_NEW */