wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
dbus_new_helpers.h
Go to the documentation of this file.
1 
6 #ifndef WPA_DBUS_CTRL_H
7 #define WPA_DBUS_CTRL_H
8 
9 #include <dbus/dbus.h>
10 
11 typedef DBusMessage * (*WPADBusMethodHandler)(DBusMessage *message,
12  void *user_data);
13 typedef void (*WPADBusArgumentFreeFunction)(void *handler_arg);
14 
15 typedef dbus_bool_t (*WPADBusPropertyAccessor)(DBusMessageIter *iter,
16  DBusError *error,
17  void *user_data);
18 
20  DBusConnection *connection;
21  char *path;
22 
23  /* list of methods, properties and signals registered with object */
24  const struct wpa_dbus_method_desc *methods;
25  const struct wpa_dbus_signal_desc *signals;
26  const struct wpa_dbus_property_desc *properties;
27 
28  /* property changed flags */
29  u8 *prop_changed_flags;
30 
31  /* argument for method handlers and properties
32  * getter and setter functions */
33  void *user_data;
34  /* function used to free above argument */
35  WPADBusArgumentFreeFunction user_data_free_func;
36 };
37 
38 enum dbus_arg_direction { ARG_IN, ARG_OUT };
39 
41  char *name;
42  char *type;
43  enum dbus_arg_direction dir;
44 };
45 
46 #define END_ARGS { NULL, NULL, ARG_IN }
47 
53  /* method name */
54  const char *dbus_method;
55  /* method interface */
56  const char *dbus_interface;
57  /* method handling function */
58  WPADBusMethodHandler method_handler;
59  /* array of arguments */
60  struct wpa_dbus_argument args[4];
61 };
62 
68  /* signal name */
69  const char *dbus_signal;
70  /* signal interface */
71  const char *dbus_interface;
72  /* array of arguments */
73  struct wpa_dbus_argument args[4];
74 };
75 
81  /* property name */
82  const char *dbus_property;
83  /* property interface */
84  const char *dbus_interface;
85  /* property type signature in DBus type notation */
86  const char *type;
87  /* property getter function */
88  WPADBusPropertyAccessor getter;
89  /* property setter function */
90  WPADBusPropertyAccessor setter;
91 };
92 
93 
94 #define WPAS_DBUS_OBJECT_PATH_MAX 150
95 #define WPAS_DBUS_INTERFACE_MAX 150
96 #define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
97 #define WPAS_DBUS_AUTH_MODE_MAX 64
98 
99 #define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
100 #define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
101 #define WPA_DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
102 #define WPA_DBUS_PROPERTIES_GET "Get"
103 #define WPA_DBUS_PROPERTIES_SET "Set"
104 #define WPA_DBUS_PROPERTIES_GETALL "GetAll"
105 
106 void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
107 
108 int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
109  char *dbus_service,
110  struct wpa_dbus_object_desc *obj_desc);
111 
113  struct wpas_dbus_priv *ctrl_iface,
114  const char *path, const char *ifname,
115  struct wpa_dbus_object_desc *obj_desc);
116 
118  struct wpas_dbus_priv *ctrl_iface,
119  const char *path);
120 
121 dbus_bool_t wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
122  const char *path,
123  const char *interface,
124  DBusMessageIter *iter);
125 
126 
127 void wpa_dbus_flush_all_changed_properties(DBusConnection *con);
128 
129 void wpa_dbus_flush_object_changed_properties(DBusConnection *con,
130  const char *path);
131 
133  const char *path, const char *interface,
134  const char *property);
135 
136 DBusMessage * wpa_dbus_introspect(DBusMessage *message,
137  struct wpa_dbus_object_desc *obj_dsc);
138 
139 char * wpas_dbus_new_decompose_object_path(const char *path, const char *sep,
140  char **item);
141 
142 DBusMessage *wpas_dbus_reply_new_from_error(DBusMessage *message,
143  DBusError *error,
144  const char *fallback_name,
145  const char *fallback_string);
146 
147 #endif /* WPA_DBUS_CTRL_H */
DBus property description.
Definition: dbus_new_helpers.h:80
char * wpas_dbus_new_decompose_object_path(const char *path, const char *sep, char **item)
Decompose an interface object path into parts.
Definition: dbus_new_helpers.c:950
DBusMessage * wpa_dbus_introspect(DBusMessage *message, struct wpa_dbus_object_desc *obj_dsc)
Responds for Introspect calls on object.
Definition: dbus_new_introspect.c:249
void wpa_dbus_flush_all_changed_properties(DBusConnection *con)
Send all PropertiesChanged signals.
Definition: dbus_new_helpers.c:776
void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc)
Frees object description data structure.
Definition: dbus_new_helpers.c:432
void wpa_dbus_flush_object_changed_properties(DBusConnection *con, const char *path)
Send PropertiesChanged for object.
Definition: dbus_new_helpers.c:799
int wpa_dbus_register_object_per_iface(struct wpas_dbus_priv *ctrl_iface, const char *path, const char *ifname, struct wpa_dbus_object_desc *obj_desc)
Register a new object with dbus.
Definition: dbus_new_helpers.c:525
Definition: dbus_common_i.h:12
DBus signal description.
Definition: dbus_new_helpers.h:67
int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path, char *dbus_service, struct wpa_dbus_object_desc *obj_desc)
Initialize dbus control interface.
Definition: dbus_new_helpers.c:465
int wpa_dbus_unregister_object_per_iface(struct wpas_dbus_priv *ctrl_iface, const char *path)
Unregisters DBus object.
Definition: dbus_new_helpers.c:575
Definition: dbus_new_helpers.h:40
DBusMessage * wpas_dbus_reply_new_from_error(DBusMessage *message, DBusError *error, const char *fallback_name, const char *fallback_string)
Create a new D-Bus error message from a dbus error structure.
Definition: dbus_new_helpers.c:1004
Definition: dbus_new_helpers.h:19
void wpa_dbus_mark_property_changed(struct wpas_dbus_priv *iface, const char *path, const char *interface, const char *property)
Mark a property as changed and.
Definition: dbus_new_helpers.c:838
dbus_bool_t wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface, const char *path, const char *interface, DBusMessageIter *iter)
Put object's properties into dictionary.
Definition: dbus_new_helpers.c:894
DBus method description.
Definition: dbus_new_helpers.h:52