dbus: Move the SIGPOLL FreeBSD compat code into dbus_common.c
[mech_eap.git] / wpa_supplicant / dbus / dbus_old.h
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
18 struct wps_credential;
19
20 #ifdef CONFIG_CTRL_IFACE_DBUS
21
22 #include <dbus/dbus.h>
23
24 #define WPAS_DBUS_OBJECT_PATH_MAX 150
25
26 #define WPAS_DBUS_SERVICE       "fi.epitest.hostap.WPASupplicant"
27 #define WPAS_DBUS_PATH          "/fi/epitest/hostap/WPASupplicant"
28 #define WPAS_DBUS_INTERFACE     "fi.epitest.hostap.WPASupplicant"
29
30 #define WPAS_DBUS_PATH_INTERFACES       WPAS_DBUS_PATH "/Interfaces"
31 #define WPAS_DBUS_IFACE_INTERFACE       WPAS_DBUS_INTERFACE ".Interface"
32
33 #define WPAS_DBUS_NETWORKS_PART "Networks"
34 #define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network"
35
36 #define WPAS_DBUS_BSSIDS_PART   "BSSIDs"
37 #define WPAS_DBUS_IFACE_BSSID   WPAS_DBUS_INTERFACE ".BSSID"
38
39
40 /* Errors */
41 #define WPAS_ERROR_INVALID_NETWORK \
42         WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork"
43 #define WPAS_ERROR_INVALID_BSSID \
44         WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID"
45
46 #define WPAS_ERROR_INVALID_OPTS \
47         WPAS_DBUS_INTERFACE ".InvalidOptions"
48 #define WPAS_ERROR_INVALID_IFACE \
49         WPAS_DBUS_INTERFACE ".InvalidInterface"
50
51 #define WPAS_ERROR_ADD_ERROR \
52         WPAS_DBUS_INTERFACE ".AddError"
53 #define WPAS_ERROR_EXISTS_ERROR \
54         WPAS_DBUS_INTERFACE ".ExistsError"
55 #define WPAS_ERROR_REMOVE_ERROR \
56         WPAS_DBUS_INTERFACE ".RemoveError"
57
58 #define WPAS_ERROR_SCAN_ERROR \
59         WPAS_DBUS_IFACE_INTERFACE ".ScanError"
60 #define WPAS_ERROR_ADD_NETWORK_ERROR \
61         WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError"
62 #define WPAS_ERROR_INTERNAL_ERROR \
63         WPAS_DBUS_IFACE_INTERFACE ".InternalError"
64 #define WPAS_ERROR_REMOVE_NETWORK_ERROR \
65         WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError"
66
67 #define WPAS_ERROR_WPS_PBC_ERROR \
68         WPAS_DBUS_IFACE_INTERFACE ".WpsPbcError"
69 #define WPAS_ERROR_WPS_PIN_ERROR \
70         WPAS_DBUS_IFACE_INTERFACE ".WpsPinError"
71 #define WPAS_ERROR_WPS_REG_ERROR \
72         WPAS_DBUS_IFACE_INTERFACE ".WpsRegError"
73
74 #define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x"
75
76 struct wpa_global;
77 struct wpa_supplicant;
78
79 int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface);
80 void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s);
81 void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s);
82 void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
83                                              enum wpa_states new_state,
84                                              enum wpa_states old_state);
85 void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
86                                          const struct wps_credential *cred);
87
88 char * wpas_dbus_decompose_object_path(const char *path, char **network,
89                                        char **bssid);
90
91 int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s);
92 int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s);
93
94
95 /* Methods internal to the dbus control interface */
96 int wpa_supplicant_set_dbus_path(struct wpa_supplicant *wpa_s,
97                                  const char *path);
98 const char *wpa_supplicant_get_dbus_path(struct wpa_supplicant *wpa_s);
99 struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
100         struct wpa_global *global, const char *path);
101
102 DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message);
103 DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message);
104
105 #else /* CONFIG_CTRL_IFACE_DBUS */
106
107 static inline void
108 wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
109 {
110 }
111
112 static inline void
113 wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
114 {
115 }
116
117 #define wpa_supplicant_dbus_notify_state_change(w,n,o) do { } while (0)
118
119 static inline void
120 wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
121                                     const struct wps_credential *cred)
122 {
123 }
124
125 static inline int
126 wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
127 {
128         return 0;
129 }
130
131 static inline int
132 wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
133 {
134         return 0;
135 }
136
137 #endif /* CONFIG_CTRL_IFACE_DBUS */
138
139 #endif /* CTRL_IFACE_DBUS_H */