dbus_old.h 4.0 KB

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