Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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, 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 WPA_DBUS_CTRL_H
  16. #define WPA_DBUS_CTRL_H
  17. #include <dbus/dbus.h>
  18. typedef DBusMessage * (* WPADBusMethodHandler)(DBusMessage *message,
  19. void *user_data);
  20. typedef void (* WPADBusArgumentFreeFunction)(void *handler_arg);
  21. typedef DBusMessage * (* WPADBusPropertyAccessor)(DBusMessage *message,
  22. const void *user_data);
  23. struct wpa_dbus_object_desc {
  24. DBusConnection *connection;
  25. char *path;
  26. /* list of methods, properties and signals registered with object */
  27. const struct wpa_dbus_method_desc *methods;
  28. const struct wpa_dbus_signal_desc *signals;
  29. const struct wpa_dbus_property_desc *properties;
  30. /* property changed flags */
  31. u8 *prop_changed_flags;
  32. /* argument for method handlers and properties
  33. * getter and setter functions */
  34. void *user_data;
  35. /* function used to free above argument */
  36. WPADBusArgumentFreeFunction user_data_free_func;
  37. };
  38. enum dbus_prop_access { R, W, RW };
  39. enum dbus_arg_direction { ARG_IN, ARG_OUT };
  40. struct wpa_dbus_argument {
  41. char *name;
  42. char *type;
  43. enum dbus_arg_direction dir;
  44. };
  45. #define END_ARGS { NULL, NULL, ARG_IN }
  46. /**
  47. * struct wpa_dbus_method_desc - DBus method description
  48. */
  49. struct wpa_dbus_method_desc {
  50. /* method name */
  51. const char *dbus_method;
  52. /* method interface */
  53. const char *dbus_interface;
  54. /* method handling function */
  55. WPADBusMethodHandler method_handler;
  56. /* array of arguments */
  57. struct wpa_dbus_argument args[3];
  58. };
  59. /**
  60. * struct wpa_dbus_signal_desc - DBus signal description
  61. */
  62. struct wpa_dbus_signal_desc {
  63. /* signal name */
  64. const char *dbus_signal;
  65. /* signal interface */
  66. const char *dbus_interface;
  67. /* array of arguments */
  68. struct wpa_dbus_argument args[3];
  69. };
  70. /**
  71. * struct wpa_dbus_property_desc - DBus property description
  72. */
  73. struct wpa_dbus_property_desc {
  74. /* property name */
  75. const char *dbus_property;
  76. /* property interface */
  77. const char *dbus_interface;
  78. /* property type signature in DBus type notation */
  79. const char *type;
  80. /* property getter function */
  81. WPADBusPropertyAccessor getter;
  82. /* property setter function */
  83. WPADBusPropertyAccessor setter;
  84. /* property access permissions */
  85. enum dbus_prop_access access;
  86. };
  87. #define WPAS_DBUS_OBJECT_PATH_MAX 150
  88. #define WPAS_DBUS_INTERFACE_MAX 150
  89. #define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
  90. #define WPAS_DBUS_AUTH_MODE_MAX 64
  91. #define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
  92. #define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
  93. #define WPA_DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
  94. #define WPA_DBUS_PROPERTIES_GET "Get"
  95. #define WPA_DBUS_PROPERTIES_SET "Set"
  96. #define WPA_DBUS_PROPERTIES_GETALL "GetAll"
  97. void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
  98. int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
  99. char *dbus_service,
  100. struct wpa_dbus_object_desc *obj_desc);
  101. int wpa_dbus_register_object_per_iface(
  102. struct wpas_dbus_priv *ctrl_iface,
  103. const char *path, const char *ifname,
  104. struct wpa_dbus_object_desc *obj_desc);
  105. int wpa_dbus_unregister_object_per_iface(
  106. struct wpas_dbus_priv *ctrl_iface,
  107. const char *path);
  108. void wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
  109. const char *path, const char *interface,
  110. DBusMessageIter *dict_iter);
  111. void wpa_dbus_flush_all_changed_properties(DBusConnection *con);
  112. void wpa_dbus_flush_object_changed_properties(DBusConnection *con,
  113. const char *path);
  114. void wpa_dbus_mark_property_changed(struct wpas_dbus_priv *iface,
  115. const char *path, const char *interface,
  116. const char *property);
  117. DBusMessage * wpa_dbus_introspect(DBusMessage *message,
  118. struct wpa_dbus_object_desc *obj_dsc);
  119. #endif /* WPA_DBUS_CTRL_H */