dbus_new.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*
  2. * WPA Supplicant / dbus-based control interface
  3. * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
  4. * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Alternatively, this software may be distributed under the terms of BSD
  11. * license.
  12. *
  13. * See README and COPYING for more details.
  14. */
  15. #ifndef CTRL_IFACE_DBUS_NEW_H
  16. #define CTRL_IFACE_DBUS_NEW_H
  17. struct wpa_global;
  18. struct wpa_supplicant;
  19. struct wpa_ssid;
  20. struct wps_event_m2d;
  21. struct wps_event_fail;
  22. struct wps_credential;
  23. enum wpa_states;
  24. enum wpas_dbus_prop {
  25. WPAS_DBUS_PROP_AP_SCAN,
  26. WPAS_DBUS_PROP_SCANNING,
  27. WPAS_DBUS_PROP_STATE,
  28. WPAS_DBUS_PROP_CURRENT_BSS,
  29. WPAS_DBUS_PROP_CURRENT_NETWORK,
  30. };
  31. enum wpas_dbus_bss_prop {
  32. WPAS_DBUS_BSS_PROP_SIGNAL,
  33. WPAS_DBUS_BSS_PROP_FREQ,
  34. WPAS_DBUS_BSS_PROP_MODE,
  35. WPAS_DBUS_BSS_PROP_PRIVACY,
  36. WPAS_DBUS_BSS_PROP_RATES,
  37. WPAS_DBUS_BSS_PROP_WPA,
  38. WPAS_DBUS_BSS_PROP_RSN,
  39. WPAS_DBUS_BSS_PROP_IES,
  40. };
  41. #define WPAS_DBUS_OBJECT_PATH_MAX 150
  42. #define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1"
  43. #define WPAS_DBUS_NEW_PATH "/fi/w1/wpa_supplicant1"
  44. #define WPAS_DBUS_NEW_INTERFACE "fi.w1.wpa_supplicant1"
  45. #define WPAS_DBUS_NEW_PATH_INTERFACES WPAS_DBUS_NEW_PATH "/Interfaces"
  46. #define WPAS_DBUS_NEW_IFACE_INTERFACE WPAS_DBUS_NEW_INTERFACE ".Interface"
  47. #define WPAS_DBUS_NEW_IFACE_WPS WPAS_DBUS_NEW_IFACE_INTERFACE ".WPS"
  48. #define WPAS_DBUS_NEW_NETWORKS_PART "Networks"
  49. #define WPAS_DBUS_NEW_IFACE_NETWORK WPAS_DBUS_NEW_INTERFACE ".Network"
  50. #define WPAS_DBUS_NEW_BSSIDS_PART "BSSs"
  51. #define WPAS_DBUS_NEW_IFACE_BSS WPAS_DBUS_NEW_INTERFACE ".BSS"
  52. /* Errors */
  53. #define WPAS_DBUS_ERROR_UNKNOWN_ERROR \
  54. WPAS_DBUS_NEW_INTERFACE ".UnknownError"
  55. #define WPAS_DBUS_ERROR_INVALID_ARGS \
  56. WPAS_DBUS_NEW_INTERFACE ".InvalidArgs"
  57. #define WPAS_DBUS_ERROR_IFACE_EXISTS \
  58. WPAS_DBUS_NEW_INTERFACE ".InterfaceExists"
  59. #define WPAS_DBUS_ERROR_IFACE_UNKNOWN \
  60. WPAS_DBUS_NEW_INTERFACE ".InterfaceUnknown"
  61. #define WPAS_DBUS_ERROR_NOT_CONNECTED \
  62. WPAS_DBUS_NEW_INTERFACE ".NotConnected"
  63. #define WPAS_DBUS_ERROR_NETWORK_UNKNOWN \
  64. WPAS_DBUS_NEW_INTERFACE ".NetworkUnknown"
  65. #define WPAS_DBUS_ERROR_BLOB_EXISTS \
  66. WPAS_DBUS_NEW_INTERFACE ".BlobExists"
  67. #define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
  68. WPAS_DBUS_NEW_INTERFACE ".BlobUnknown"
  69. #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
  70. int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
  71. void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface);
  72. int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s);
  73. int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s);
  74. void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
  75. enum wpas_dbus_prop property);
  76. void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s,
  77. enum wpas_dbus_bss_prop property,
  78. unsigned int id);
  79. void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
  80. struct wpa_ssid *ssid);
  81. void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id);
  82. void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success);
  83. void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
  84. const struct wps_credential *cred);
  85. void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
  86. struct wps_event_m2d *m2d);
  87. void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
  88. struct wps_event_fail *fail);
  89. void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s);
  90. int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
  91. struct wpa_ssid *ssid);
  92. int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid);
  93. int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
  94. u8 bssid[ETH_ALEN], unsigned int id);
  95. int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
  96. u8 bssid[ETH_ALEN], unsigned int id);
  97. void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
  98. const char *name);
  99. void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
  100. const char *name);
  101. void wpas_dbus_signal_debug_level_changed(struct wpa_global *global);
  102. void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global);
  103. void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global);
  104. #else /* CONFIG_CTRL_IFACE_DBUS_NEW */
  105. static inline int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
  106. {
  107. return 0;
  108. }
  109. static inline int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
  110. {
  111. return 0;
  112. }
  113. #define wpas_dbus_signal_state_changed(w, n, o) do { } while (0)
  114. static inline void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
  115. enum wpas_dbus_prop property)
  116. {
  117. }
  118. static inline void wpas_dbus_bss_signal_prop_changed(
  119. struct wpa_supplicant *wpa_s, enum wpas_dbus_bss_prop property,
  120. unsigned int id)
  121. {
  122. }
  123. static inline void wpas_dbus_signal_network_enabled_changed(
  124. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
  125. {
  126. }
  127. static inline void wpas_dbus_signal_network_selected(
  128. struct wpa_supplicant *wpa_s, int id)
  129. {
  130. }
  131. static inline void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s,
  132. int success)
  133. {
  134. }
  135. static inline void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
  136. const struct wps_credential *cred)
  137. {
  138. }
  139. static inline void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
  140. struct wps_event_m2d *m2d)
  141. {
  142. }
  143. static inline void wpas_dbus_signal_wps_event_fail(
  144. struct wpa_supplicant *wpa_s, struct wps_event_fail *fail)
  145. {
  146. }
  147. static inline void wpas_dbus_signal_wps_event_success(
  148. struct wpa_supplicant *wpa_s)
  149. {
  150. }
  151. static inline int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
  152. struct wpa_ssid *ssid)
  153. {
  154. return 0;
  155. }
  156. static inline int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s,
  157. int nid)
  158. {
  159. return 0;
  160. }
  161. static inline int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
  162. u8 bssid[ETH_ALEN], unsigned int id)
  163. {
  164. return 0;
  165. }
  166. static inline int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
  167. u8 bssid[ETH_ALEN], unsigned int id)
  168. {
  169. return 0;
  170. }
  171. static inline void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
  172. const char *name)
  173. {
  174. }
  175. static inline void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
  176. const char *name)
  177. {
  178. }
  179. static inline void wpas_dbus_signal_debug_level_changed(
  180. struct wpa_global *global)
  181. {
  182. }
  183. static inline void wpas_dbus_signal_debug_timestamp_changed(
  184. struct wpa_global *global)
  185. {
  186. }
  187. static inline void wpas_dbus_signal_debug_show_keys_changed(
  188. struct wpa_global *global)
  189. {
  190. }
  191. #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  192. #endif /* CTRL_IFACE_DBUS_H_NEW */