]>
Commit | Line | Data |
---|---|---|
6fc6879b JM |
1 | /* |
2 | * WPA Supplicant / dbus-based control interface | |
3 | * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. | |
4 | * | |
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. | |
8 | * | |
9 | * Alternatively, this software may be distributed under the terms of BSD | |
10 | * license. | |
11 | * | |
12 | * See README and COPYING for more details. | |
13 | */ | |
14 | ||
15 | #ifndef CTRL_IFACE_DBUS_H | |
16 | #define CTRL_IFACE_DBUS_H | |
17 | ||
47662164 JM |
18 | struct wps_credential; |
19 | ||
6fc6879b JM |
20 | #ifdef CONFIG_CTRL_IFACE_DBUS |
21 | ||
22 | #ifndef SIGPOLL | |
23 | #ifdef SIGIO | |
24 | /* | |
25 | * If we do not have SIGPOLL, try to use SIGIO instead. This is needed for | |
26 | * FreeBSD. | |
27 | */ | |
28 | #define SIGPOLL SIGIO | |
29 | #endif | |
30 | #endif | |
31 | ||
32 | #include <dbus/dbus.h> | |
33 | ||
34 | #define WPAS_DBUS_OBJECT_PATH_MAX 150 | |
35 | ||
36 | #define WPAS_DBUS_SERVICE "fi.epitest.hostap.WPASupplicant" | |
37 | #define WPAS_DBUS_PATH "/fi/epitest/hostap/WPASupplicant" | |
38 | #define WPAS_DBUS_INTERFACE "fi.epitest.hostap.WPASupplicant" | |
39 | ||
40 | #define WPAS_DBUS_PATH_INTERFACES WPAS_DBUS_PATH "/Interfaces" | |
41 | #define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface" | |
42 | ||
43 | #define WPAS_DBUS_NETWORKS_PART "Networks" | |
44 | #define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network" | |
45 | ||
46 | #define WPAS_DBUS_BSSIDS_PART "BSSIDs" | |
47 | #define WPAS_DBUS_IFACE_BSSID WPAS_DBUS_INTERFACE ".BSSID" | |
48 | ||
49 | ||
50 | /* Errors */ | |
51 | #define WPAS_ERROR_INVALID_NETWORK \ | |
52 | WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork" | |
53 | #define WPAS_ERROR_INVALID_BSSID \ | |
54 | WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID" | |
55 | ||
56 | #define WPAS_ERROR_INVALID_OPTS \ | |
57 | WPAS_DBUS_INTERFACE ".InvalidOptions" | |
58 | #define WPAS_ERROR_INVALID_IFACE \ | |
59 | WPAS_DBUS_INTERFACE ".InvalidInterface" | |
60 | ||
61 | #define WPAS_ERROR_ADD_ERROR \ | |
62 | WPAS_DBUS_INTERFACE ".AddError" | |
63 | #define WPAS_ERROR_EXISTS_ERROR \ | |
64 | WPAS_DBUS_INTERFACE ".ExistsError" | |
65 | #define WPAS_ERROR_REMOVE_ERROR \ | |
66 | WPAS_DBUS_INTERFACE ".RemoveError" | |
67 | ||
68 | #define WPAS_ERROR_SCAN_ERROR \ | |
69 | WPAS_DBUS_IFACE_INTERFACE ".ScanError" | |
70 | #define WPAS_ERROR_ADD_NETWORK_ERROR \ | |
71 | WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError" | |
72 | #define WPAS_ERROR_INTERNAL_ERROR \ | |
73 | WPAS_DBUS_IFACE_INTERFACE ".InternalError" | |
74 | #define WPAS_ERROR_REMOVE_NETWORK_ERROR \ | |
75 | WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError" | |
76 | ||
e8fa6039 JSP |
77 | #ifdef CONFIG_WPS |
78 | #define WPAS_ERROR_WPS_PBC_ERROR \ | |
79 | WPAS_DBUS_IFACE_INTERFACE ".WpsPbcError" | |
80 | #define WPAS_ERROR_WPS_PIN_ERROR \ | |
81 | WPAS_DBUS_IFACE_INTERFACE ".WpsPinError" | |
82 | #define WPAS_ERROR_WPS_REG_ERROR \ | |
83 | WPAS_DBUS_IFACE_INTERFACE ".WpsRegError" | |
84 | #endif /* CONFIG_WPS */ | |
85 | ||
6fc6879b JM |
86 | #define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x" |
87 | ||
88 | struct wpa_global; | |
89 | struct wpa_supplicant; | |
90 | ||
91 | struct ctrl_iface_dbus_priv * | |
92 | wpa_supplicant_dbus_ctrl_iface_init(struct wpa_global *global); | |
93 | void wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface); | |
94 | void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s); | |
cb8564b1 | 95 | void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s); |
6fc6879b JM |
96 | void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s, |
97 | wpa_states new_state, | |
98 | wpa_states old_state); | |
47662164 JM |
99 | void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s, |
100 | const struct wps_credential *cred); | |
6fc6879b JM |
101 | |
102 | char * wpas_dbus_decompose_object_path(const char *path, char **network, | |
103 | char **bssid); | |
104 | ||
105 | int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s); | |
106 | int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s); | |
107 | ||
108 | ||
109 | /* Methods internal to the dbus control interface */ | |
110 | u32 wpa_supplicant_dbus_next_objid(struct ctrl_iface_dbus_priv *iface); | |
111 | ||
112 | int wpa_supplicant_set_dbus_path(struct wpa_supplicant *wpa_s, | |
113 | const char *path); | |
114 | const char *wpa_supplicant_get_dbus_path(struct wpa_supplicant *wpa_s); | |
115 | struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path( | |
116 | struct wpa_global *global, const char *path); | |
117 | ||
118 | DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message); | |
119 | DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message); | |
120 | ||
121 | #else /* CONFIG_CTRL_IFACE_DBUS */ | |
122 | ||
123 | static inline struct ctrl_iface_dbus_priv * | |
124 | wpa_supplicant_dbus_ctrl_iface_init(struct wpa_global *global) | |
125 | { | |
126 | return (struct ctrl_iface_dbus_priv *) 1; | |
127 | } | |
128 | ||
129 | static inline void | |
130 | wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface) | |
131 | { | |
132 | } | |
133 | ||
134 | static inline void | |
135 | wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s) | |
136 | { | |
137 | } | |
138 | ||
cb8564b1 DW |
139 | static inline void |
140 | wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s) | |
141 | { | |
142 | } | |
143 | ||
6fc6879b JM |
144 | static inline void |
145 | wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s, | |
146 | wpa_states new_state, | |
147 | wpa_states old_state) | |
148 | { | |
149 | } | |
150 | ||
47662164 JM |
151 | static inline void |
152 | wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s, | |
153 | const struct wps_credential *cred) | |
154 | { | |
155 | } | |
156 | ||
6fc6879b JM |
157 | static inline int |
158 | wpas_dbus_register_iface(struct wpa_supplicant *wpa_s) | |
159 | { | |
160 | return 0; | |
161 | } | |
162 | ||
163 | static inline int | |
164 | wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s) | |
165 | { | |
166 | return 0; | |
167 | } | |
168 | ||
169 | #endif /* CONFIG_CTRL_IFACE_DBUS */ | |
170 | ||
171 | #endif /* CTRL_IFACE_DBUS_H */ |