$search
00001 /* 00002 * WPA Supplicant / dbus-based control interface 00003 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. 00004 * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License version 2 as 00008 * published by the Free Software Foundation. 00009 * 00010 * Alternatively, this software may be distributed under the terms of BSD 00011 * license. 00012 * 00013 * See README and COPYING for more details. 00014 */ 00015 00016 #ifndef CTRL_IFACE_DBUS_NEW_H 00017 #define CTRL_IFACE_DBUS_NEW_H 00018 00019 struct wpa_global; 00020 struct wpa_supplicant; 00021 struct wpa_ssid; 00022 struct wps_event_m2d; 00023 struct wps_event_fail; 00024 struct wps_credential; 00025 enum wpa_states; 00026 00027 enum wpas_dbus_prop { 00028 WPAS_DBUS_PROP_AP_SCAN, 00029 WPAS_DBUS_PROP_SCANNING, 00030 WPAS_DBUS_PROP_STATE, 00031 WPAS_DBUS_PROP_CURRENT_BSS, 00032 WPAS_DBUS_PROP_CURRENT_NETWORK, 00033 }; 00034 00035 enum wpas_dbus_bss_prop { 00036 WPAS_DBUS_BSS_PROP_SIGNAL, 00037 WPAS_DBUS_BSS_PROP_FREQ, 00038 WPAS_DBUS_BSS_PROP_MODE, 00039 WPAS_DBUS_BSS_PROP_PRIVACY, 00040 WPAS_DBUS_BSS_PROP_RATES, 00041 WPAS_DBUS_BSS_PROP_WPA, 00042 WPAS_DBUS_BSS_PROP_RSN, 00043 WPAS_DBUS_BSS_PROP_IES, 00044 }; 00045 00046 #define WPAS_DBUS_OBJECT_PATH_MAX 150 00047 00048 #define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1" 00049 #define WPAS_DBUS_NEW_PATH "/fi/w1/wpa_supplicant1" 00050 #define WPAS_DBUS_NEW_INTERFACE "fi.w1.wpa_supplicant1" 00051 00052 #define WPAS_DBUS_NEW_PATH_INTERFACES WPAS_DBUS_NEW_PATH "/Interfaces" 00053 #define WPAS_DBUS_NEW_IFACE_INTERFACE WPAS_DBUS_NEW_INTERFACE ".Interface" 00054 #define WPAS_DBUS_NEW_IFACE_WPS WPAS_DBUS_NEW_IFACE_INTERFACE ".WPS" 00055 00056 #define WPAS_DBUS_NEW_NETWORKS_PART "Networks" 00057 #define WPAS_DBUS_NEW_IFACE_NETWORK WPAS_DBUS_NEW_INTERFACE ".Network" 00058 00059 #define WPAS_DBUS_NEW_BSSIDS_PART "BSSs" 00060 #define WPAS_DBUS_NEW_IFACE_BSS WPAS_DBUS_NEW_INTERFACE ".BSS" 00061 00062 00063 /* Errors */ 00064 #define WPAS_DBUS_ERROR_UNKNOWN_ERROR \ 00065 WPAS_DBUS_NEW_INTERFACE ".UnknownError" 00066 #define WPAS_DBUS_ERROR_INVALID_ARGS \ 00067 WPAS_DBUS_NEW_INTERFACE ".InvalidArgs" 00068 00069 #define WPAS_DBUS_ERROR_IFACE_EXISTS \ 00070 WPAS_DBUS_NEW_INTERFACE ".InterfaceExists" 00071 #define WPAS_DBUS_ERROR_IFACE_UNKNOWN \ 00072 WPAS_DBUS_NEW_INTERFACE ".InterfaceUnknown" 00073 00074 #define WPAS_DBUS_ERROR_NOT_CONNECTED \ 00075 WPAS_DBUS_NEW_INTERFACE ".NotConnected" 00076 #define WPAS_DBUS_ERROR_NETWORK_UNKNOWN \ 00077 WPAS_DBUS_NEW_INTERFACE ".NetworkUnknown" 00078 00079 #define WPAS_DBUS_ERROR_BLOB_EXISTS \ 00080 WPAS_DBUS_NEW_INTERFACE ".BlobExists" 00081 #define WPAS_DBUS_ERROR_BLOB_UNKNOWN \ 00082 WPAS_DBUS_NEW_INTERFACE ".BlobUnknown" 00083 00084 00085 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW 00086 00087 int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv); 00088 void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface); 00089 00090 int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s); 00091 int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s); 00092 void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s, 00093 enum wpas_dbus_prop property); 00094 void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s, 00095 enum wpas_dbus_bss_prop property, 00096 unsigned int id); 00097 void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s, 00098 struct wpa_ssid *ssid); 00099 void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id); 00100 void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success); 00101 void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s, 00102 const struct wps_credential *cred); 00103 void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s, 00104 struct wps_event_m2d *m2d); 00105 void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s, 00106 struct wps_event_fail *fail); 00107 void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s); 00108 int wpas_dbus_register_network(struct wpa_supplicant *wpa_s, 00109 struct wpa_ssid *ssid); 00110 int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid); 00111 int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s, 00112 u8 bssid[ETH_ALEN], unsigned int id); 00113 int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s, 00114 u8 bssid[ETH_ALEN], unsigned int id); 00115 void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s, 00116 const char *name); 00117 void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s, 00118 const char *name); 00119 void wpas_dbus_signal_debug_level_changed(struct wpa_global *global); 00120 void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global); 00121 void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global); 00122 00123 #else /* CONFIG_CTRL_IFACE_DBUS_NEW */ 00124 00125 static inline int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s) 00126 { 00127 return 0; 00128 } 00129 00130 static inline int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s) 00131 { 00132 return 0; 00133 } 00134 00135 #define wpas_dbus_signal_state_changed(w, n, o) do { } while (0) 00136 00137 static inline void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s, 00138 enum wpas_dbus_prop property) 00139 { 00140 } 00141 00142 static inline void wpas_dbus_bss_signal_prop_changed( 00143 struct wpa_supplicant *wpa_s, enum wpas_dbus_bss_prop property, 00144 unsigned int id) 00145 { 00146 } 00147 00148 static inline void wpas_dbus_signal_network_enabled_changed( 00149 struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) 00150 { 00151 } 00152 00153 static inline void wpas_dbus_signal_network_selected( 00154 struct wpa_supplicant *wpa_s, int id) 00155 { 00156 } 00157 00158 static inline void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, 00159 int success) 00160 { 00161 } 00162 00163 static inline void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s, 00164 const struct wps_credential *cred) 00165 { 00166 } 00167 00168 static inline void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s, 00169 struct wps_event_m2d *m2d) 00170 { 00171 } 00172 00173 static inline void wpas_dbus_signal_wps_event_fail( 00174 struct wpa_supplicant *wpa_s, struct wps_event_fail *fail) 00175 { 00176 } 00177 00178 static inline void wpas_dbus_signal_wps_event_success( 00179 struct wpa_supplicant *wpa_s) 00180 { 00181 } 00182 00183 static inline int wpas_dbus_register_network(struct wpa_supplicant *wpa_s, 00184 struct wpa_ssid *ssid) 00185 { 00186 return 0; 00187 } 00188 00189 static inline int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, 00190 int nid) 00191 { 00192 return 0; 00193 } 00194 00195 static inline int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s, 00196 u8 bssid[ETH_ALEN], unsigned int id) 00197 { 00198 return 0; 00199 } 00200 00201 static inline int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s, 00202 u8 bssid[ETH_ALEN], unsigned int id) 00203 { 00204 return 0; 00205 } 00206 00207 static inline void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s, 00208 const char *name) 00209 { 00210 } 00211 00212 static inline void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s, 00213 const char *name) 00214 { 00215 } 00216 00217 static inline void wpas_dbus_signal_debug_level_changed( 00218 struct wpa_global *global) 00219 { 00220 } 00221 00222 static inline void wpas_dbus_signal_debug_timestamp_changed( 00223 struct wpa_global *global) 00224 { 00225 } 00226 00227 static inline void wpas_dbus_signal_debug_show_keys_changed( 00228 struct wpa_global *global) 00229 { 00230 } 00231 00232 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ 00233 00234 #endif /* CTRL_IFACE_DBUS_H_NEW */