00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef WPA_DBUS_CTRL_H
00017 #define WPA_DBUS_CTRL_H
00018
00019 #include <dbus/dbus.h>
00020
00021 typedef DBusMessage * (* WPADBusMethodHandler)(DBusMessage *message,
00022 void *user_data);
00023 typedef void (* WPADBusArgumentFreeFunction)(void *handler_arg);
00024
00025 typedef DBusMessage * (* WPADBusPropertyAccessor)(DBusMessage *message,
00026 const void *user_data);
00027
00028 struct wpa_dbus_object_desc {
00029 DBusConnection *connection;
00030 char *path;
00031
00032
00033 const struct wpa_dbus_method_desc *methods;
00034 const struct wpa_dbus_signal_desc *signals;
00035 const struct wpa_dbus_property_desc *properties;
00036
00037
00038 u8 *prop_changed_flags;
00039
00040
00041
00042 void *user_data;
00043
00044 WPADBusArgumentFreeFunction user_data_free_func;
00045 };
00046
00047 enum dbus_prop_access { R, W, RW };
00048
00049 enum dbus_arg_direction { ARG_IN, ARG_OUT };
00050
00051 struct wpa_dbus_argument {
00052 char *name;
00053 char *type;
00054 enum dbus_arg_direction dir;
00055 };
00056
00057 #define END_ARGS { NULL, NULL, ARG_IN }
00058
00062 struct wpa_dbus_method_desc {
00063
00064 const char *dbus_method;
00065
00066 const char *dbus_interface;
00067
00068 WPADBusMethodHandler method_handler;
00069
00070 struct wpa_dbus_argument args[3];
00071 };
00072
00076 struct wpa_dbus_signal_desc {
00077
00078 const char *dbus_signal;
00079
00080 const char *dbus_interface;
00081
00082 struct wpa_dbus_argument args[3];
00083 };
00084
00088 struct wpa_dbus_property_desc {
00089
00090 const char *dbus_property;
00091
00092 const char *dbus_interface;
00093
00094 const char *type;
00095
00096 WPADBusPropertyAccessor getter;
00097
00098 WPADBusPropertyAccessor setter;
00099
00100 enum dbus_prop_access access;
00101 };
00102
00103
00104 #define WPAS_DBUS_OBJECT_PATH_MAX 150
00105 #define WPAS_DBUS_INTERFACE_MAX 150
00106 #define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
00107
00108 #define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
00109 #define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
00110 #define WPA_DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
00111 #define WPA_DBUS_PROPERTIES_GET "Get"
00112 #define WPA_DBUS_PROPERTIES_SET "Set"
00113 #define WPA_DBUS_PROPERTIES_GETALL "GetAll"
00114
00115 void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
00116
00117 int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
00118 char *dbus_service,
00119 struct wpa_dbus_object_desc *obj_desc);
00120
00121 int wpa_dbus_register_object_per_iface(
00122 struct wpas_dbus_priv *ctrl_iface,
00123 const char *path, const char *ifname,
00124 struct wpa_dbus_object_desc *obj_desc);
00125
00126 int wpa_dbus_unregister_object_per_iface(
00127 struct wpas_dbus_priv *ctrl_iface,
00128 const char *path);
00129
00130 void wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
00131 const char *path, const char *interface,
00132 DBusMessageIter *dict_iter);
00133
00134
00135 void wpa_dbus_flush_all_changed_properties(DBusConnection *con);
00136
00137 void wpa_dbus_flush_object_changed_properties(DBusConnection *con,
00138 const char *path);
00139
00140 void wpa_dbus_mark_property_changed(struct wpas_dbus_priv *iface,
00141 const char *path, const char *interface,
00142 const char *property);
00143
00144 DBusMessage * wpa_dbus_introspect(DBusMessage *message,
00145 struct wpa_dbus_object_desc *obj_dsc);
00146
00147 #endif