dbus_old.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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.
  13. */
  14. #ifndef CTRL_IFACE_DBUS_H
  15. #define CTRL_IFACE_DBUS_H
  16. struct wps_credential;
  17. #ifdef CONFIG_CTRL_IFACE_DBUS
  18. #include <dbus/dbus.h>
  19. #define WPAS_DBUS_OBJECT_PATH_MAX 150
  20. #define WPAS_DBUS_SERVICE "fi.epitest.hostap.WPASupplicant"
  21. #define WPAS_DBUS_PATH "/fi/epitest/hostap/WPASupplicant"
  22. #define WPAS_DBUS_INTERFACE "fi.epitest.hostap.WPASupplicant"
  23. #define WPAS_DBUS_PATH_INTERFACES WPAS_DBUS_PATH "/Interfaces"
  24. #define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface"
  25. #define WPAS_DBUS_NETWORKS_PART "Networks"
  26. #define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network"
  27. #define WPAS_DBUS_BSSIDS_PART "BSSIDs"
  28. #define WPAS_DBUS_IFACE_BSSID WPAS_DBUS_INTERFACE ".BSSID"
  29. /* Errors */
  30. #define WPAS_ERROR_INVALID_NETWORK \
  31. WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork"
  32. #define WPAS_ERROR_INVALID_BSSID \
  33. WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID"
  34. #define WPAS_ERROR_INVALID_OPTS \
  35. WPAS_DBUS_INTERFACE ".InvalidOptions"
  36. #define WPAS_ERROR_INVALID_IFACE \
  37. WPAS_DBUS_INTERFACE ".InvalidInterface"
  38. #define WPAS_ERROR_ADD_ERROR \
  39. WPAS_DBUS_INTERFACE ".AddError"
  40. #define WPAS_ERROR_EXISTS_ERROR \
  41. WPAS_DBUS_INTERFACE ".ExistsError"
  42. #define WPAS_ERROR_REMOVE_ERROR \
  43. WPAS_DBUS_INTERFACE ".RemoveError"
  44. #define WPAS_ERROR_SCAN_ERROR \
  45. WPAS_DBUS_IFACE_INTERFACE ".ScanError"
  46. #define WPAS_ERROR_ADD_NETWORK_ERROR \
  47. WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError"
  48. #define WPAS_ERROR_INTERNAL_ERROR \
  49. WPAS_DBUS_IFACE_INTERFACE ".InternalError"
  50. #define WPAS_ERROR_REMOVE_NETWORK_ERROR \
  51. WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError"
  52. #define WPAS_ERROR_WPS_PBC_ERROR \
  53. WPAS_DBUS_IFACE_INTERFACE ".WpsPbcError"
  54. #define WPAS_ERROR_WPS_PIN_ERROR \
  55. WPAS_DBUS_IFACE_INTERFACE ".WpsPinError"
  56. #define WPAS_ERROR_WPS_REG_ERROR \
  57. WPAS_DBUS_IFACE_INTERFACE ".WpsRegError"
  58. #define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x"
  59. struct wpa_global;
  60. struct wpa_supplicant;
  61. int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface);
  62. void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s);
  63. void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s);
  64. void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
  65. enum wpa_states new_state,
  66. enum wpa_states old_state);
  67. void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
  68. const struct wps_credential *cred);
  69. char * wpas_dbus_decompose_object_path(const char *path, char **network,
  70. char **bssid);
  71. int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s);
  72. int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s);
  73. /* Methods internal to the dbus control interface */
  74. int wpa_supplicant_set_dbus_path(struct wpa_supplicant *wpa_s,
  75. const char *path);
  76. const char *wpa_supplicant_get_dbus_path(struct wpa_supplicant *wpa_s);
  77. struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
  78. struct wpa_global *global, const char *path);
  79. DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message);
  80. DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message);
  81. #else /* CONFIG_CTRL_IFACE_DBUS */
  82. static inline void
  83. wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
  84. {
  85. }
  86. static inline void
  87. wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
  88. {
  89. }
  90. #define wpa_supplicant_dbus_notify_state_change(w,n,o) do { } while (0)
  91. static inline void
  92. wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
  93. const struct wps_credential *cred)
  94. {
  95. }
  96. static inline int
  97. wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
  98. {
  99. return 0;
  100. }
  101. static inline int
  102. wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
  103. {
  104. return 0;
  105. }
  106. #endif /* CONFIG_CTRL_IFACE_DBUS */
  107. #endif /* CTRL_IFACE_DBUS_H */