Line data Source code
1 : /*
2 : * WPA Supplicant / dbus-based control interface
3 : * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
4 : * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
5 : *
6 : * This software may be distributed under the terms of the BSD license.
7 : * See README for more details.
8 : */
9 :
10 : #ifndef CTRL_IFACE_DBUS_NEW_H
11 : #define CTRL_IFACE_DBUS_NEW_H
12 :
13 : #include "common/defs.h"
14 : #include "p2p/p2p.h"
15 :
16 : struct wpa_global;
17 : struct wpa_supplicant;
18 : struct wpa_ssid;
19 : struct wps_event_m2d;
20 : struct wps_event_fail;
21 : struct wps_credential;
22 :
23 : enum wpas_dbus_prop {
24 : WPAS_DBUS_PROP_AP_SCAN,
25 : WPAS_DBUS_PROP_SCANNING,
26 : WPAS_DBUS_PROP_STATE,
27 : WPAS_DBUS_PROP_CURRENT_BSS,
28 : WPAS_DBUS_PROP_CURRENT_NETWORK,
29 : WPAS_DBUS_PROP_CURRENT_AUTH_MODE,
30 : WPAS_DBUS_PROP_BSSS,
31 : WPAS_DBUS_PROP_DISCONNECT_REASON,
32 : };
33 :
34 : enum wpas_dbus_bss_prop {
35 : WPAS_DBUS_BSS_PROP_SIGNAL,
36 : WPAS_DBUS_BSS_PROP_FREQ,
37 : WPAS_DBUS_BSS_PROP_MODE,
38 : WPAS_DBUS_BSS_PROP_PRIVACY,
39 : WPAS_DBUS_BSS_PROP_RATES,
40 : WPAS_DBUS_BSS_PROP_WPA,
41 : WPAS_DBUS_BSS_PROP_RSN,
42 : WPAS_DBUS_BSS_PROP_WPS,
43 : WPAS_DBUS_BSS_PROP_IES,
44 : };
45 :
46 : #define WPAS_DBUS_OBJECT_PATH_MAX 150
47 :
48 : #define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1"
49 : #define WPAS_DBUS_NEW_PATH "/fi/w1/wpa_supplicant1"
50 : #define WPAS_DBUS_NEW_INTERFACE "fi.w1.wpa_supplicant1"
51 :
52 : #define WPAS_DBUS_NEW_PATH_INTERFACES WPAS_DBUS_NEW_PATH "/Interfaces"
53 : #define WPAS_DBUS_NEW_IFACE_INTERFACE WPAS_DBUS_NEW_INTERFACE ".Interface"
54 : #define WPAS_DBUS_NEW_IFACE_WPS WPAS_DBUS_NEW_IFACE_INTERFACE ".WPS"
55 :
56 : #define WPAS_DBUS_NEW_NETWORKS_PART "Networks"
57 : #define WPAS_DBUS_NEW_IFACE_NETWORK WPAS_DBUS_NEW_INTERFACE ".Network"
58 :
59 : #define WPAS_DBUS_NEW_BSSIDS_PART "BSSs"
60 : #define WPAS_DBUS_NEW_IFACE_BSS WPAS_DBUS_NEW_INTERFACE ".BSS"
61 :
62 : #define WPAS_DBUS_NEW_IFACE_P2PDEVICE \
63 : WPAS_DBUS_NEW_IFACE_INTERFACE ".P2PDevice"
64 :
65 : /*
66 : * Groups correspond to P2P groups where this device is a GO (owner)
67 : */
68 : #define WPAS_DBUS_NEW_P2P_GROUPS_PART "Groups"
69 : #define WPAS_DBUS_NEW_IFACE_P2P_GROUP WPAS_DBUS_NEW_INTERFACE ".Group"
70 :
71 : /*
72 : * Different dbus object for persistent groups so they do not get confused
73 : * with regular (configured) network objects.
74 : */
75 : #define WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "PersistentGroups"
76 : #define WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP \
77 : WPAS_DBUS_NEW_INTERFACE ".PersistentGroup"
78 :
79 : #define WPAS_DBUS_NEW_P2P_PEERS_PART "Peers"
80 : #define WPAS_DBUS_NEW_IFACE_P2P_PEER WPAS_DBUS_NEW_INTERFACE ".Peer"
81 :
82 : #define WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "Members"
83 : #define WPAS_DBUS_NEW_IFACE_P2P_GROUPMEMBER \
84 : WPAS_DBUS_NEW_INTERFACE ".GroupMember"
85 :
86 : /* Top-level Errors */
87 : #define WPAS_DBUS_ERROR_UNKNOWN_ERROR \
88 : WPAS_DBUS_NEW_INTERFACE ".UnknownError"
89 : #define WPAS_DBUS_ERROR_INVALID_ARGS \
90 : WPAS_DBUS_NEW_INTERFACE ".InvalidArgs"
91 :
92 : #define WPAS_DBUS_ERROR_IFACE_EXISTS \
93 : WPAS_DBUS_NEW_INTERFACE ".InterfaceExists"
94 : #define WPAS_DBUS_ERROR_IFACE_DISABLED \
95 : WPAS_DBUS_NEW_INTERFACE ".InterfaceDisabled"
96 : #define WPAS_DBUS_ERROR_IFACE_UNKNOWN \
97 : WPAS_DBUS_NEW_INTERFACE ".InterfaceUnknown"
98 :
99 : #define WPAS_DBUS_ERROR_NOT_CONNECTED \
100 : WPAS_DBUS_NEW_INTERFACE ".NotConnected"
101 : #define WPAS_DBUS_ERROR_NETWORK_UNKNOWN \
102 : WPAS_DBUS_NEW_INTERFACE ".NetworkUnknown"
103 :
104 : #define WPAS_DBUS_ERROR_CONNECT_CHANNEL_UNAVAILABLE \
105 : WPAS_DBUS_NEW_INTERFACE ".ConnectChannelUnavailable"
106 : #define WPAS_DBUS_ERROR_CONNECT_CHANNEL_UNSUPPORTED \
107 : WPAS_DBUS_NEW_INTERFACE ".ConnectChannelUnsupported"
108 : #define WPAS_DBUS_ERROR_CONNECT_UNSPECIFIED_ERROR \
109 : WPAS_DBUS_NEW_INTERFACE ".ConnectUnspecifiedError"
110 :
111 : #define WPAS_DBUS_ERROR_BLOB_EXISTS \
112 : WPAS_DBUS_NEW_INTERFACE ".BlobExists"
113 : #define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
114 : WPAS_DBUS_NEW_INTERFACE ".BlobUnknown"
115 :
116 : #define WPAS_DBUS_ERROR_SUBSCRIPTION_IN_USE \
117 : WPAS_DBUS_NEW_INTERFACE ".SubscriptionInUse"
118 : #define WPAS_DBUS_ERROR_NO_SUBSCRIPTION \
119 : WPAS_DBUS_NEW_INTERFACE ".NoSubscription"
120 : #define WPAS_DBUS_ERROR_SUBSCRIPTION_EPERM \
121 : WPAS_DBUS_NEW_INTERFACE ".SubscriptionNotYou"
122 :
123 : /* Interface-level errors */
124 : #define WPAS_DBUS_ERROR_IFACE_SCAN_ERROR \
125 : WPAS_DBUS_NEW_IFACE_INTERFACE ".ScanError"
126 :
127 : void wpas_dbus_subscribe_noc(struct wpas_dbus_priv *priv);
128 : void wpas_dbus_unsubscribe_noc(struct wpas_dbus_priv *priv);
129 :
130 :
131 : #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
132 :
133 : int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
134 : void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface);
135 :
136 : int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s);
137 : int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s);
138 : void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
139 : enum wpas_dbus_prop property);
140 : void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s,
141 : enum wpas_dbus_bss_prop property,
142 : unsigned int id);
143 : void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
144 : struct wpa_ssid *ssid);
145 : void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id);
146 : void wpas_dbus_signal_network_request(struct wpa_supplicant *wpa_s,
147 : struct wpa_ssid *ssid,
148 : enum wpa_ctrl_req_type rtype,
149 : const char *default_text);
150 : void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success);
151 : void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
152 : const struct wps_credential *cred);
153 : void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
154 : struct wps_event_m2d *m2d);
155 : void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
156 : struct wps_event_fail *fail);
157 : void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s);
158 : int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
159 : struct wpa_ssid *ssid);
160 : int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid);
161 : int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
162 : u8 bssid[ETH_ALEN], unsigned int id);
163 : int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
164 : u8 bssid[ETH_ALEN], unsigned int id);
165 : void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
166 : const char *name);
167 : void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
168 : const char *name);
169 : void wpas_dbus_signal_debug_level_changed(struct wpa_global *global);
170 : void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global);
171 : void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global);
172 :
173 : int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr);
174 : void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
175 : const u8 *dev_addr);
176 : int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
177 : const u8 *dev_addr);
178 : void wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
179 : const u8 *dev_addr);
180 : void wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
181 : const char *role);
182 : void wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
183 : const u8 *dev_addr, int request,
184 : enum p2p_prov_disc_status status,
185 : u16 config_methods,
186 : unsigned int generated_pin);
187 : void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
188 : const u8 *src, u16 dev_passwd_id);
189 : void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
190 : const struct wpa_ssid *ssid,
191 : int client, int network_id);
192 : void wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
193 : struct wpa_ssid *ssid);
194 : void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
195 : struct p2p_go_neg_results *res);
196 : void wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
197 : const struct wpa_ssid *ssid);
198 : int wpas_dbus_register_persistent_group(struct wpa_supplicant *wpa_s,
199 : struct wpa_ssid *ssid);
200 : int wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s,
201 : int nid);
202 : void wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s,
203 : int status, const u8 *bssid);
204 : void wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s,
205 : const u8 *p2p_if_addr);
206 : void wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s,
207 : const u8 *p2p_if_addr);
208 : void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
209 : const u8 *member);
210 : void wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s,
211 : int freq, const u8 *sa, u8 dialog_token,
212 : u16 update_indic, const u8 *tlvs,
213 : size_t tlvs_len);
214 : void wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
215 : const u8 *sa, u16 update_indic,
216 : const u8 *tlvs, size_t tlvs_len);
217 : void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
218 : const u8 *member);
219 : void wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
220 : struct wps_event_fail *fail);
221 : void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
222 : int depth, const char *subject,
223 : const char *cert_hash,
224 : const struct wpabuf *cert);
225 : void wpas_dbus_signal_preq(struct wpa_supplicant *wpa_s,
226 : const u8 *addr, const u8 *dst, const u8 *bssid,
227 : const u8 *ie, size_t ie_len, u32 ssi_signal);
228 : void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
229 : const char *status, const char *parameter);
230 : void wpas_dbus_signal_sta_authorized(struct wpa_supplicant *wpa_s,
231 : const u8 *sta);
232 : void wpas_dbus_signal_sta_deauthorized(struct wpa_supplicant *wpa_s,
233 : const u8 *sta);
234 :
235 : #else /* CONFIG_CTRL_IFACE_DBUS_NEW */
236 :
237 69 : static inline int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
238 : {
239 69 : return 0;
240 : }
241 :
242 69 : static inline int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
243 : {
244 69 : return 0;
245 : }
246 :
247 : #define wpas_dbus_signal_state_changed(w, n, o) do { } while (0)
248 :
249 16600 : static inline void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
250 : enum wpas_dbus_prop property)
251 : {
252 16600 : }
253 :
254 112 : static inline void wpas_dbus_bss_signal_prop_changed(
255 : struct wpa_supplicant *wpa_s, enum wpas_dbus_bss_prop property,
256 : unsigned int id)
257 : {
258 112 : }
259 :
260 550 : static inline void wpas_dbus_signal_network_enabled_changed(
261 : struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
262 : {
263 550 : }
264 :
265 570 : static inline void wpas_dbus_signal_network_selected(
266 : struct wpa_supplicant *wpa_s, int id)
267 : {
268 570 : }
269 :
270 15 : static inline void wpas_dbus_signal_network_request(
271 : struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
272 : enum wpa_ctrl_req_type rtype, const char *default_txt)
273 : {
274 15 : }
275 :
276 1083 : static inline void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s,
277 : int success)
278 : {
279 1083 : }
280 :
281 1 : static inline void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
282 : const struct wps_credential *cred)
283 : {
284 1 : }
285 :
286 20 : static inline void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
287 : struct wps_event_m2d *m2d)
288 : {
289 20 : }
290 :
291 39 : static inline void wpas_dbus_signal_wps_event_fail(
292 : struct wpa_supplicant *wpa_s, struct wps_event_fail *fail)
293 : {
294 39 : }
295 :
296 155 : static inline void wpas_dbus_signal_wps_event_success(
297 : struct wpa_supplicant *wpa_s)
298 : {
299 155 : }
300 :
301 744 : static inline int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
302 : struct wpa_ssid *ssid)
303 : {
304 744 : return 0;
305 : }
306 :
307 744 : static inline int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s,
308 : int nid)
309 : {
310 744 : return 0;
311 : }
312 :
313 961 : static inline int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
314 : u8 bssid[ETH_ALEN], unsigned int id)
315 : {
316 961 : return 0;
317 : }
318 :
319 961 : static inline int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
320 : u8 bssid[ETH_ALEN], unsigned int id)
321 : {
322 961 : return 0;
323 : }
324 :
325 0 : static inline void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
326 : const char *name)
327 : {
328 0 : }
329 :
330 0 : static inline void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
331 : const char *name)
332 : {
333 0 : }
334 :
335 0 : static inline void wpas_dbus_signal_debug_level_changed(
336 : struct wpa_global *global)
337 : {
338 0 : }
339 :
340 0 : static inline void wpas_dbus_signal_debug_timestamp_changed(
341 : struct wpa_global *global)
342 : {
343 0 : }
344 :
345 0 : static inline void wpas_dbus_signal_debug_show_keys_changed(
346 : struct wpa_global *global)
347 : {
348 0 : }
349 :
350 308 : static inline int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s,
351 : const u8 *dev_addr)
352 : {
353 308 : return 0;
354 : }
355 :
356 308 : static inline int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
357 : const u8 *dev_addr)
358 : {
359 308 : return 0;
360 : }
361 :
362 : static inline void
363 243 : wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
364 : const char *role)
365 : {
366 243 : }
367 :
368 : static inline void
369 47 : wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
370 : const u8 *dev_addr, int request,
371 : enum p2p_prov_disc_status status,
372 : u16 config_methods,
373 : unsigned int generated_pin)
374 : {
375 47 : }
376 :
377 15 : static inline void wpas_dbus_signal_p2p_go_neg_req(
378 : struct wpa_supplicant *wpa_s,
379 : const u8 *src,
380 : u16 dev_passwd_id)
381 : {
382 15 : }
383 :
384 : static inline void
385 230 : wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
386 : const struct wpa_ssid *ssid,
387 : int client, int network_id)
388 : {
389 230 : }
390 :
391 : static inline void
392 230 : wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
393 : struct wpa_ssid *ssid)
394 : {
395 230 : }
396 :
397 31 : static inline int wpas_dbus_register_persistent_group(
398 : struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
399 : {
400 31 : return 0;
401 : }
402 :
403 0 : static inline int wpas_dbus_unregister_persistent_group(
404 : struct wpa_supplicant *wpa_s, int nid)
405 : {
406 0 : return 0;
407 : }
408 :
409 : static inline void
410 153 : wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
411 : struct p2p_go_neg_results *res)
412 : {
413 153 : }
414 :
415 : static inline void
416 243 : wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
417 : const struct wpa_ssid *ssid)
418 : {
419 243 : }
420 :
421 25 : static inline void wpas_dbus_signal_p2p_invitation_result(
422 : struct wpa_supplicant *wpa_s, int status,
423 : const u8 *bssid)
424 : {
425 25 : }
426 :
427 : static inline void
428 134 : wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s,
429 : const u8 *p2p_if_addr)
430 : {
431 134 : }
432 :
433 : static inline void
434 23 : wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s, int freq,
435 : const u8 *sa, u8 dialog_token, u16 update_indic,
436 : const u8 *tlvs, size_t tlvs_len)
437 : {
438 23 : }
439 :
440 : static inline void
441 23 : wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
442 : const u8 *sa, u16 update_indic,
443 : const u8 *tlvs, size_t tlvs_len)
444 : {
445 23 : }
446 :
447 : static inline void
448 134 : wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s,
449 : const u8 *p2p_if_addr)
450 : {
451 134 : }
452 :
453 : static inline void
454 134 : wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
455 : const u8 *member)
456 : {
457 134 : }
458 :
459 : static inline void
460 313 : wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
461 : const u8 *dev_addr)
462 : {
463 313 : }
464 :
465 : static inline void
466 308 : wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
467 : const u8 *dev_addr)
468 : {
469 308 : }
470 :
471 : static inline void
472 134 : wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
473 : const u8 *member)
474 : {
475 134 : }
476 :
477 : static inline void
478 3 : wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
479 : struct wps_event_fail *fail)
480 : {
481 3 : }
482 :
483 396 : static inline void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
484 : int depth,
485 : const char *subject,
486 : const char *cert_hash,
487 : const struct wpabuf *cert)
488 : {
489 396 : }
490 :
491 247 : static inline void wpas_dbus_signal_preq(struct wpa_supplicant *wpa_s,
492 : const u8 *addr, const u8 *dst,
493 : const u8 *bssid,
494 : const u8 *ie, size_t ie_len,
495 : u32 ssi_signal)
496 : {
497 247 : }
498 :
499 2108 : static inline void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
500 : const char *status,
501 : const char *parameter)
502 : {
503 2108 : }
504 :
505 : static inline
506 134 : void wpas_dbus_signal_sta_authorized(struct wpa_supplicant *wpa_s,
507 : const u8 *sta)
508 : {
509 134 : }
510 :
511 : static inline
512 134 : void wpas_dbus_signal_sta_deauthorized(struct wpa_supplicant *wpa_s,
513 : const u8 *sta)
514 : {
515 134 : }
516 :
517 : #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
518 :
519 : #endif /* CTRL_IFACE_DBUS_H_NEW */
|