Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

dbus_new.h 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. WPAS_DBUS_PROP_CURRENT_AUTH_MODE,
  31. WPAS_DBUS_PROP_BSSS,
  32. };
  33. enum wpas_dbus_bss_prop {
  34. WPAS_DBUS_BSS_PROP_SIGNAL,
  35. WPAS_DBUS_BSS_PROP_FREQ,
  36. WPAS_DBUS_BSS_PROP_MODE,
  37. WPAS_DBUS_BSS_PROP_PRIVACY,
  38. WPAS_DBUS_BSS_PROP_RATES,
  39. WPAS_DBUS_BSS_PROP_WPA,
  40. WPAS_DBUS_BSS_PROP_RSN,
  41. WPAS_DBUS_BSS_PROP_IES,
  42. };
  43. #define WPAS_DBUS_OBJECT_PATH_MAX 150
  44. #define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1"
  45. #define WPAS_DBUS_NEW_PATH "/fi/w1/wpa_supplicant1"
  46. #define WPAS_DBUS_NEW_INTERFACE "fi.w1.wpa_supplicant1"
  47. #define WPAS_DBUS_NEW_PATH_INTERFACES WPAS_DBUS_NEW_PATH "/Interfaces"
  48. #define WPAS_DBUS_NEW_IFACE_INTERFACE WPAS_DBUS_NEW_INTERFACE ".Interface"
  49. #define WPAS_DBUS_NEW_IFACE_WPS WPAS_DBUS_NEW_IFACE_INTERFACE ".WPS"
  50. #define WPAS_DBUS_NEW_NETWORKS_PART "Networks"
  51. #define WPAS_DBUS_NEW_IFACE_NETWORK WPAS_DBUS_NEW_INTERFACE ".Network"
  52. #define WPAS_DBUS_NEW_BSSIDS_PART "BSSs"
  53. #define WPAS_DBUS_NEW_IFACE_BSS WPAS_DBUS_NEW_INTERFACE ".BSS"
  54. /* Errors */
  55. #define WPAS_DBUS_ERROR_UNKNOWN_ERROR \
  56. WPAS_DBUS_NEW_INTERFACE ".UnknownError"
  57. #define WPAS_DBUS_ERROR_INVALID_ARGS \
  58. WPAS_DBUS_NEW_INTERFACE ".InvalidArgs"
  59. #define WPAS_DBUS_ERROR_IFACE_EXISTS \
  60. WPAS_DBUS_NEW_INTERFACE ".InterfaceExists"
  61. #define WPAS_DBUS_ERROR_IFACE_UNKNOWN \
  62. WPAS_DBUS_NEW_INTERFACE ".InterfaceUnknown"
  63. #define WPAS_DBUS_ERROR_NOT_CONNECTED \
  64. WPAS_DBUS_NEW_INTERFACE ".NotConnected"
  65. #define WPAS_DBUS_ERROR_NETWORK_UNKNOWN \
  66. WPAS_DBUS_NEW_INTERFACE ".NetworkUnknown"
  67. #define WPAS_DBUS_ERROR_BLOB_EXISTS \
  68. WPAS_DBUS_NEW_INTERFACE ".BlobExists"
  69. #define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
  70. WPAS_DBUS_NEW_INTERFACE ".BlobUnknown"
  71. #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
  72. int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
  73. void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface);
  74. int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s);
  75. int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s);
  76. void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
  77. enum wpas_dbus_prop property);
  78. void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s,
  79. enum wpas_dbus_bss_prop property,
  80. unsigned int id);
  81. void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
  82. struct wpa_ssid *ssid);
  83. void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id);
  84. void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success);
  85. void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
  86. const struct wps_credential *cred);
  87. void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
  88. struct wps_event_m2d *m2d);
  89. void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
  90. struct wps_event_fail *fail);
  91. void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s);
  92. int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
  93. struct wpa_ssid *ssid);
  94. int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid);
  95. int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
  96. u8 bssid[ETH_ALEN], unsigned int id);
  97. int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
  98. u8 bssid[ETH_ALEN], unsigned int id);
  99. void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
  100. const char *name);
  101. void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
  102. const char *name);
  103. void wpas_dbus_signal_debug_level_changed(struct wpa_global *global);
  104. void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global);
  105. void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global);
  106. #else /* CONFIG_CTRL_IFACE_DBUS_NEW */
  107. static inline int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
  108. {
  109. return 0;
  110. }
  111. static inline int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
  112. {
  113. return 0;
  114. }
  115. #define wpas_dbus_signal_state_changed(w, n, o) do { } while (0)
  116. static inline void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
  117. enum wpas_dbus_prop property)
  118. {
  119. }
  120. static inline void wpas_dbus_bss_signal_prop_changed(
  121. struct wpa_supplicant *wpa_s, enum wpas_dbus_bss_prop property,
  122. unsigned int id)
  123. {
  124. }
  125. static inline void wpas_dbus_signal_network_enabled_changed(
  126. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
  127. {
  128. }
  129. static inline void wpas_dbus_signal_network_selected(
  130. struct wpa_supplicant *wpa_s, int id)
  131. {
  132. }
  133. static inline void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s,
  134. int success)
  135. {
  136. }
  137. static inline void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
  138. const struct wps_credential *cred)
  139. {
  140. }
  141. static inline void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
  142. struct wps_event_m2d *m2d)
  143. {
  144. }
  145. static inline void wpas_dbus_signal_wps_event_fail(
  146. struct wpa_supplicant *wpa_s, struct wps_event_fail *fail)
  147. {
  148. }
  149. static inline void wpas_dbus_signal_wps_event_success(
  150. struct wpa_supplicant *wpa_s)
  151. {
  152. }
  153. static inline int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
  154. struct wpa_ssid *ssid)
  155. {
  156. return 0;
  157. }
  158. static inline int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s,
  159. int nid)
  160. {
  161. return 0;
  162. }
  163. static inline int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
  164. u8 bssid[ETH_ALEN], unsigned int id)
  165. {
  166. return 0;
  167. }
  168. static inline int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
  169. u8 bssid[ETH_ALEN], unsigned int id)
  170. {
  171. return 0;
  172. }
  173. static inline void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
  174. const char *name)
  175. {
  176. }
  177. static inline void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
  178. const char *name)
  179. {
  180. }
  181. static inline void wpas_dbus_signal_debug_level_changed(
  182. struct wpa_global *global)
  183. {
  184. }
  185. static inline void wpas_dbus_signal_debug_timestamp_changed(
  186. struct wpa_global *global)
  187. {
  188. }
  189. static inline void wpas_dbus_signal_debug_show_keys_changed(
  190. struct wpa_global *global)
  191. {
  192. }
  193. #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  194. #endif /* CTRL_IFACE_DBUS_H_NEW */