1/* 2 * WPA Supplicant / dbus-based control interface 3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. 4 *
| 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.
| 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details.
|
13 */ 14 15#ifndef CTRL_IFACE_DBUS_H 16#define CTRL_IFACE_DBUS_H 17 18struct wps_credential; 19 20#ifdef CONFIG_CTRL_IFACE_DBUS 21 22#define WPAS_DBUS_OBJECT_PATH_MAX 150 23 24#define WPAS_DBUS_SERVICE "fi.epitest.hostap.WPASupplicant" 25#define WPAS_DBUS_PATH "/fi/epitest/hostap/WPASupplicant" 26#define WPAS_DBUS_INTERFACE "fi.epitest.hostap.WPASupplicant" 27 28#define WPAS_DBUS_PATH_INTERFACES WPAS_DBUS_PATH "/Interfaces" 29#define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface" 30 31#define WPAS_DBUS_NETWORKS_PART "Networks" 32#define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network" 33 34#define WPAS_DBUS_BSSIDS_PART "BSSIDs" 35#define WPAS_DBUS_IFACE_BSSID WPAS_DBUS_INTERFACE ".BSSID" 36 37 38/* Errors */ 39#define WPAS_ERROR_INVALID_NETWORK \ 40 WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork" 41#define WPAS_ERROR_INVALID_BSSID \ 42 WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID" 43 44#define WPAS_ERROR_INVALID_OPTS \ 45 WPAS_DBUS_INTERFACE ".InvalidOptions" 46#define WPAS_ERROR_INVALID_IFACE \ 47 WPAS_DBUS_INTERFACE ".InvalidInterface" 48 49#define WPAS_ERROR_ADD_ERROR \ 50 WPAS_DBUS_INTERFACE ".AddError" 51#define WPAS_ERROR_EXISTS_ERROR \ 52 WPAS_DBUS_INTERFACE ".ExistsError" 53#define WPAS_ERROR_REMOVE_ERROR \ 54 WPAS_DBUS_INTERFACE ".RemoveError" 55 56#define WPAS_ERROR_SCAN_ERROR \ 57 WPAS_DBUS_IFACE_INTERFACE ".ScanError" 58#define WPAS_ERROR_ADD_NETWORK_ERROR \ 59 WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError" 60#define WPAS_ERROR_INTERNAL_ERROR \ 61 WPAS_DBUS_IFACE_INTERFACE ".InternalError" 62#define WPAS_ERROR_REMOVE_NETWORK_ERROR \ 63 WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError" 64 65#define WPAS_ERROR_WPS_PBC_ERROR \ 66 WPAS_DBUS_IFACE_INTERFACE ".WpsPbcError" 67#define WPAS_ERROR_WPS_PIN_ERROR \ 68 WPAS_DBUS_IFACE_INTERFACE ".WpsPinError" 69#define WPAS_ERROR_WPS_REG_ERROR \ 70 WPAS_DBUS_IFACE_INTERFACE ".WpsRegError" 71 72#define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x" 73 74struct wpa_global; 75struct wpa_supplicant; 76 77int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface); 78void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s); 79void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s); 80void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s, 81 enum wpa_states new_state, 82 enum wpa_states old_state); 83void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s, 84 const struct wps_credential *cred);
| 7 */ 8 9#ifndef CTRL_IFACE_DBUS_H 10#define CTRL_IFACE_DBUS_H 11 12struct wps_credential; 13 14#ifdef CONFIG_CTRL_IFACE_DBUS 15 16#define WPAS_DBUS_OBJECT_PATH_MAX 150 17 18#define WPAS_DBUS_SERVICE "fi.epitest.hostap.WPASupplicant" 19#define WPAS_DBUS_PATH "/fi/epitest/hostap/WPASupplicant" 20#define WPAS_DBUS_INTERFACE "fi.epitest.hostap.WPASupplicant" 21 22#define WPAS_DBUS_PATH_INTERFACES WPAS_DBUS_PATH "/Interfaces" 23#define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface" 24 25#define WPAS_DBUS_NETWORKS_PART "Networks" 26#define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network" 27 28#define WPAS_DBUS_BSSIDS_PART "BSSIDs" 29#define WPAS_DBUS_IFACE_BSSID WPAS_DBUS_INTERFACE ".BSSID" 30 31 32/* Errors */ 33#define WPAS_ERROR_INVALID_NETWORK \ 34 WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork" 35#define WPAS_ERROR_INVALID_BSSID \ 36 WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID" 37 38#define WPAS_ERROR_INVALID_OPTS \ 39 WPAS_DBUS_INTERFACE ".InvalidOptions" 40#define WPAS_ERROR_INVALID_IFACE \ 41 WPAS_DBUS_INTERFACE ".InvalidInterface" 42 43#define WPAS_ERROR_ADD_ERROR \ 44 WPAS_DBUS_INTERFACE ".AddError" 45#define WPAS_ERROR_EXISTS_ERROR \ 46 WPAS_DBUS_INTERFACE ".ExistsError" 47#define WPAS_ERROR_REMOVE_ERROR \ 48 WPAS_DBUS_INTERFACE ".RemoveError" 49 50#define WPAS_ERROR_SCAN_ERROR \ 51 WPAS_DBUS_IFACE_INTERFACE ".ScanError" 52#define WPAS_ERROR_ADD_NETWORK_ERROR \ 53 WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError" 54#define WPAS_ERROR_INTERNAL_ERROR \ 55 WPAS_DBUS_IFACE_INTERFACE ".InternalError" 56#define WPAS_ERROR_REMOVE_NETWORK_ERROR \ 57 WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError" 58 59#define WPAS_ERROR_WPS_PBC_ERROR \ 60 WPAS_DBUS_IFACE_INTERFACE ".WpsPbcError" 61#define WPAS_ERROR_WPS_PIN_ERROR \ 62 WPAS_DBUS_IFACE_INTERFACE ".WpsPinError" 63#define WPAS_ERROR_WPS_REG_ERROR \ 64 WPAS_DBUS_IFACE_INTERFACE ".WpsRegError" 65 66#define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x" 67 68struct wpa_global; 69struct wpa_supplicant; 70 71int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface); 72void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s); 73void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s); 74void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s, 75 enum wpa_states new_state, 76 enum wpa_states old_state); 77void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s, 78 const struct wps_credential *cred);
|
| 79void wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s, 80 int depth, const char *subject, 81 const char *cert_hash, 82 const struct wpabuf *cert);
|
85 86char * wpas_dbus_decompose_object_path(const char *path, char **network, 87 char **bssid); 88 89int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s); 90int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s); 91 92 93/* Methods internal to the dbus control interface */ 94struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path( 95 struct wpa_global *global, const char *path); 96 97#else /* CONFIG_CTRL_IFACE_DBUS */ 98 99static inline void 100wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s) 101{ 102} 103 104static inline void 105wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s) 106{ 107} 108 109#define wpa_supplicant_dbus_notify_state_change(w,n,o) do { } while (0) 110 111static inline void 112wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s, 113 const struct wps_credential *cred) 114{ 115} 116
| 83 84char * wpas_dbus_decompose_object_path(const char *path, char **network, 85 char **bssid); 86 87int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s); 88int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s); 89 90 91/* Methods internal to the dbus control interface */ 92struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path( 93 struct wpa_global *global, const char *path); 94 95#else /* CONFIG_CTRL_IFACE_DBUS */ 96 97static inline void 98wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s) 99{ 100} 101 102static inline void 103wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s) 104{ 105} 106 107#define wpa_supplicant_dbus_notify_state_change(w,n,o) do { } while (0) 108 109static inline void 110wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s, 111 const struct wps_credential *cred) 112{ 113} 114
|
| 115static inline void 116wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s, 117 int depth, const char *subject, 118 const char *cert_hash, 119 const struct wpabuf *cert) 120{ 121} 122
|
117static inline int 118wpas_dbus_register_iface(struct wpa_supplicant *wpa_s) 119{ 120 return 0; 121} 122 123static inline int 124wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s) 125{ 126 return 0; 127} 128 129#endif /* CONFIG_CTRL_IFACE_DBUS */ 130 131#endif /* CTRL_IFACE_DBUS_H */
| 123static inline int 124wpas_dbus_register_iface(struct wpa_supplicant *wpa_s) 125{ 126 return 0; 127} 128 129static inline int 130wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s) 131{ 132 return 0; 133} 134 135#endif /* CONFIG_CTRL_IFACE_DBUS */ 136 137#endif /* CTRL_IFACE_DBUS_H */
|