MFC: An off-by-one malloc size was corrupting the installer's memory,
[dragonfly.git] / contrib / wpa_supplicant-0.5.8 / ctrl_iface_dbus.h
blobb66c179c596e2b09ffbad7f052fc3acdeb0afc83
1 /*
2 * WPA Supplicant / dbus-based control interface
3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
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
10 * license.
12 * See README and COPYING for more details.
15 #ifndef CTRL_IFACE_DBUS_H
16 #define CTRL_IFACE_DBUS_H
18 #ifdef CONFIG_CTRL_IFACE_DBUS
20 #ifndef SIGPOLL
21 #ifdef SIGIO
23 * If we do not have SIGPOLL, try to use SIGIO instead. This is needed for
24 * FreeBSD.
26 #define SIGPOLL SIGIO
27 #endif
28 #endif
30 #include <dbus/dbus.h>
32 #define WPAS_DBUS_OBJECT_PATH_MAX 150
34 #define WPAS_DBUS_SERVICE "fi.epitest.hostap.WPASupplicant"
35 #define WPAS_DBUS_PATH "/fi/epitest/hostap/WPASupplicant"
36 #define WPAS_DBUS_INTERFACE "fi.epitest.hostap.WPASupplicant"
38 #define WPAS_DBUS_PATH_INTERFACES WPAS_DBUS_PATH "/Interfaces"
39 #define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface"
41 #define WPAS_DBUS_NETWORKS_PART "Networks"
42 #define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network"
44 #define WPAS_DBUS_BSSIDS_PART "BSSIDs"
45 #define WPAS_DBUS_IFACE_BSSID WPAS_DBUS_INTERFACE ".BSSID"
48 /* Errors */
49 #define WPAS_ERROR_INVALID_NETWORK \
50 WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork"
51 #define WPAS_ERROR_INVALID_BSSID \
52 WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID"
54 #define WPAS_ERROR_INVALID_OPTS \
55 WPAS_DBUS_INTERFACE ".InvalidOptions"
56 #define WPAS_ERROR_INVALID_IFACE \
57 WPAS_DBUS_INTERFACE ".InvalidInterface"
59 #define WPAS_ERROR_ADD_ERROR \
60 WPAS_DBUS_INTERFACE ".AddError"
61 #define WPAS_ERROR_EXISTS_ERROR \
62 WPAS_DBUS_INTERFACE ".ExistsError"
63 #define WPAS_ERROR_REMOVE_ERROR \
64 WPAS_DBUS_INTERFACE ".RemoveError"
66 #define WPAS_ERROR_SCAN_ERROR \
67 WPAS_DBUS_IFACE_INTERFACE ".ScanError"
68 #define WPAS_ERROR_ADD_NETWORK_ERROR \
69 WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError"
70 #define WPAS_ERROR_INTERNAL_ERROR \
71 WPAS_DBUS_IFACE_INTERFACE ".InternalError"
72 #define WPAS_ERROR_REMOVE_NETWORK_ERROR \
73 WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError"
75 #define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x"
77 struct wpa_global;
78 struct wpa_supplicant;
80 struct ctrl_iface_dbus_priv *
81 wpa_supplicant_dbus_ctrl_iface_init(struct wpa_global *global);
82 void wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface);
83 void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s);
84 void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
85 wpa_states new_state,
86 wpa_states old_state);
88 char * wpas_dbus_decompose_object_path(const char *path, char **network,
89 char **bssid);
91 int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s);
92 int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s);
95 /* Methods internal to the dbus control interface */
96 u32 wpa_supplicant_dbus_next_objid(struct ctrl_iface_dbus_priv *iface);
98 int wpa_supplicant_set_dbus_path(struct wpa_supplicant *wpa_s,
99 const char *path);
100 const char *wpa_supplicant_get_dbus_path(struct wpa_supplicant *wpa_s);
101 struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
102 struct wpa_global *global, const char *path);
104 DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message);
105 DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message);
107 #else /* CONFIG_CTRL_IFACE_DBUS */
109 static inline struct ctrl_iface_dbus_priv *
110 wpa_supplicant_dbus_ctrl_iface_init(struct wpa_global *global)
112 return (struct ctrl_iface_dbus_priv *) 1;
115 static inline void
116 wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface)
120 static inline void
121 wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
125 static inline void
126 wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
127 wpa_states new_state,
128 wpa_states old_state)
132 static inline int
133 wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
135 return 0;
138 static inline int
139 wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
141 return 0;
144 #endif /* CONFIG_CTRL_IFACE_DBUS */
146 #endif /* CTRL_IFACE_DBUS_H */