1/* GDBus - GLib D-Bus Library
2 *
3 * Copyright (C) 2008-2010 Red Hat, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: David Zeuthen <[email protected]>
19 */
20
21#ifndef __G_DBUS_INTROSPECTION_H__
22#define __G_DBUS_INTROSPECTION_H__
23
24#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25#error "Only <gio/gio.h> can be included directly."
26#endif
27
28#include <gio/giotypes.h>
29
30G_BEGIN_DECLS
31
32/**
33 * GDBusAnnotationInfo:
34 * @ref_count: The reference count or -1 if statically allocated.
35 * @key: The name of the annotation, e.g. "org.freedesktop.DBus.Deprecated".
36 * @value: The value of the annotation.
37 * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
38 *
39 * Information about an annotation.
40 *
41 * Since: 2.26
42 */
43struct _GDBusAnnotationInfo
44{
45 /*< public >*/
46 volatile gint ref_count;
47 gchar *key;
48 gchar *value;
49 GDBusAnnotationInfo **annotations;
50};
51
52/**
53 * GDBusArgInfo:
54 * @ref_count: The reference count or -1 if statically allocated.
55 * @name: Name of the argument, e.g. @unix_user_id.
56 * @signature: D-Bus signature of the argument (a single complete type).
57 * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
58 *
59 * Information about an argument for a method or a signal.
60 *
61 * Since: 2.26
62 */
63struct _GDBusArgInfo
64{
65 /*< public >*/
66 volatile gint ref_count;
67 gchar *name;
68 gchar *signature;
69 GDBusAnnotationInfo **annotations;
70};
71
72/**
73 * GDBusMethodInfo:
74 * @ref_count: The reference count or -1 if statically allocated.
75 * @name: The name of the D-Bus method, e.g. @RequestName.
76 * @in_args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no in arguments.
77 * @out_args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no out arguments.
78 * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
79 *
80 * Information about a method on an D-Bus interface.
81 *
82 * Since: 2.26
83 */
84struct _GDBusMethodInfo
85{
86 /*< public >*/
87 volatile gint ref_count;
88 gchar *name;
89 GDBusArgInfo **in_args;
90 GDBusArgInfo **out_args;
91 GDBusAnnotationInfo **annotations;
92};
93
94/**
95 * GDBusSignalInfo:
96 * @ref_count: The reference count or -1 if statically allocated.
97 * @name: The name of the D-Bus signal, e.g. "NameOwnerChanged".
98 * @args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no arguments.
99 * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
100 *
101 * Information about a signal on a D-Bus interface.
102 *
103 * Since: 2.26
104 */
105struct _GDBusSignalInfo
106{
107 /*< public >*/
108 volatile gint ref_count;
109 gchar *name;
110 GDBusArgInfo **args;
111 GDBusAnnotationInfo **annotations;
112};
113
114/**
115 * GDBusPropertyInfo:
116 * @ref_count: The reference count or -1 if statically allocated.
117 * @name: The name of the D-Bus property, e.g. "SupportedFilesystems".
118 * @signature: The D-Bus signature of the property (a single complete type).
119 * @flags: Access control flags for the property.
120 * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
121 *
122 * Information about a D-Bus property on a D-Bus interface.
123 *
124 * Since: 2.26
125 */
126struct _GDBusPropertyInfo
127{
128 /*< public >*/
129 volatile gint ref_count;
130 gchar *name;
131 gchar *signature;
132 GDBusPropertyInfoFlags flags;
133 GDBusAnnotationInfo **annotations;
134};
135
136/**
137 * GDBusInterfaceInfo:
138 * @ref_count: The reference count or -1 if statically allocated.
139 * @name: The name of the D-Bus interface, e.g. "org.freedesktop.DBus.Properties".
140 * @methods: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusMethodInfo structures or %NULL if there are no methods.
141 * @signals: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusSignalInfo structures or %NULL if there are no signals.
142 * @properties: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusPropertyInfo structures or %NULL if there are no properties.
143 * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
144 *
145 * Information about a D-Bus interface.
146 *
147 * Since: 2.26
148 */
149struct _GDBusInterfaceInfo
150{
151 /*< public >*/
152 volatile gint ref_count;
153 gchar *name;
154 GDBusMethodInfo **methods;
155 GDBusSignalInfo **signals;
156 GDBusPropertyInfo **properties;
157 GDBusAnnotationInfo **annotations;
158};
159
160/**
161 * GDBusNodeInfo:
162 * @ref_count: The reference count or -1 if statically allocated.
163 * @path: The path of the node or %NULL if omitted. Note that this may be a relative path. See the D-Bus specification for more details.
164 * @interfaces: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusInterfaceInfo structures or %NULL if there are no interfaces.
165 * @nodes: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusNodeInfo structures or %NULL if there are no nodes.
166 * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
167 *
168 * Information about nodes in a remote object hierarchy.
169 *
170 * Since: 2.26
171 */
172struct _GDBusNodeInfo
173{
174 /*< public >*/
175 volatile gint ref_count;
176 gchar *path;
177 GDBusInterfaceInfo **interfaces;
178 GDBusNodeInfo **nodes;
179 GDBusAnnotationInfo **annotations;
180};
181
182GLIB_AVAILABLE_IN_ALL
183const gchar *g_dbus_annotation_info_lookup (GDBusAnnotationInfo **annotations,
184 const gchar *name);
185GLIB_AVAILABLE_IN_ALL
186GDBusMethodInfo *g_dbus_interface_info_lookup_method (GDBusInterfaceInfo *info,
187 const gchar *name);
188GLIB_AVAILABLE_IN_ALL
189GDBusSignalInfo *g_dbus_interface_info_lookup_signal (GDBusInterfaceInfo *info,
190 const gchar *name);
191GLIB_AVAILABLE_IN_ALL
192GDBusPropertyInfo *g_dbus_interface_info_lookup_property (GDBusInterfaceInfo *info,
193 const gchar *name);
194GLIB_AVAILABLE_IN_ALL
195void g_dbus_interface_info_cache_build (GDBusInterfaceInfo *info);
196GLIB_AVAILABLE_IN_ALL
197void g_dbus_interface_info_cache_release (GDBusInterfaceInfo *info);
198
199GLIB_AVAILABLE_IN_ALL
200void g_dbus_interface_info_generate_xml (GDBusInterfaceInfo *info,
201 guint indent,
202 GString *string_builder);
203
204GLIB_AVAILABLE_IN_ALL
205GDBusNodeInfo *g_dbus_node_info_new_for_xml (const gchar *xml_data,
206 GError **error);
207GLIB_AVAILABLE_IN_ALL
208GDBusInterfaceInfo *g_dbus_node_info_lookup_interface (GDBusNodeInfo *info,
209 const gchar *name);
210GLIB_AVAILABLE_IN_ALL
211void g_dbus_node_info_generate_xml (GDBusNodeInfo *info,
212 guint indent,
213 GString *string_builder);
214
215GLIB_AVAILABLE_IN_ALL
216GDBusNodeInfo *g_dbus_node_info_ref (GDBusNodeInfo *info);
217GLIB_AVAILABLE_IN_ALL
218GDBusInterfaceInfo *g_dbus_interface_info_ref (GDBusInterfaceInfo *info);
219GLIB_AVAILABLE_IN_ALL
220GDBusMethodInfo *g_dbus_method_info_ref (GDBusMethodInfo *info);
221GLIB_AVAILABLE_IN_ALL
222GDBusSignalInfo *g_dbus_signal_info_ref (GDBusSignalInfo *info);
223GLIB_AVAILABLE_IN_ALL
224GDBusPropertyInfo *g_dbus_property_info_ref (GDBusPropertyInfo *info);
225GLIB_AVAILABLE_IN_ALL
226GDBusArgInfo *g_dbus_arg_info_ref (GDBusArgInfo *info);
227GLIB_AVAILABLE_IN_ALL
228GDBusAnnotationInfo *g_dbus_annotation_info_ref (GDBusAnnotationInfo *info);
229
230GLIB_AVAILABLE_IN_ALL
231void g_dbus_node_info_unref (GDBusNodeInfo *info);
232GLIB_AVAILABLE_IN_ALL
233void g_dbus_interface_info_unref (GDBusInterfaceInfo *info);
234GLIB_AVAILABLE_IN_ALL
235void g_dbus_method_info_unref (GDBusMethodInfo *info);
236GLIB_AVAILABLE_IN_ALL
237void g_dbus_signal_info_unref (GDBusSignalInfo *info);
238GLIB_AVAILABLE_IN_ALL
239void g_dbus_property_info_unref (GDBusPropertyInfo *info);
240GLIB_AVAILABLE_IN_ALL
241void g_dbus_arg_info_unref (GDBusArgInfo *info);
242GLIB_AVAILABLE_IN_ALL
243void g_dbus_annotation_info_unref (GDBusAnnotationInfo *info);
244
245/**
246 * G_TYPE_DBUS_NODE_INFO:
247 *
248 * The #GType for a boxed type holding a #GDBusNodeInfo.
249 *
250 * Since: 2.26
251 */
252#define G_TYPE_DBUS_NODE_INFO (g_dbus_node_info_get_type ())
253
254/**
255 * G_TYPE_DBUS_INTERFACE_INFO:
256 *
257 * The #GType for a boxed type holding a #GDBusInterfaceInfo.
258 *
259 * Since: 2.26
260 */
261#define G_TYPE_DBUS_INTERFACE_INFO (g_dbus_interface_info_get_type ())
262
263/**
264 * G_TYPE_DBUS_METHOD_INFO:
265 *
266 * The #GType for a boxed type holding a #GDBusMethodInfo.
267 *
268 * Since: 2.26
269 */
270#define G_TYPE_DBUS_METHOD_INFO (g_dbus_method_info_get_type ())
271
272/**
273 * G_TYPE_DBUS_SIGNAL_INFO:
274 *
275 * The #GType for a boxed type holding a #GDBusSignalInfo.
276 *
277 * Since: 2.26
278 */
279#define G_TYPE_DBUS_SIGNAL_INFO (g_dbus_signal_info_get_type ())
280
281/**
282 * G_TYPE_DBUS_PROPERTY_INFO:
283 *
284 * The #GType for a boxed type holding a #GDBusPropertyInfo.
285 *
286 * Since: 2.26
287 */
288#define G_TYPE_DBUS_PROPERTY_INFO (g_dbus_property_info_get_type ())
289
290/**
291 * G_TYPE_DBUS_ARG_INFO:
292 *
293 * The #GType for a boxed type holding a #GDBusArgInfo.
294 *
295 * Since: 2.26
296 */
297#define G_TYPE_DBUS_ARG_INFO (g_dbus_arg_info_get_type ())
298
299/**
300 * G_TYPE_DBUS_ANNOTATION_INFO:
301 *
302 * The #GType for a boxed type holding a #GDBusAnnotationInfo.
303 *
304 * Since: 2.26
305 */
306#define G_TYPE_DBUS_ANNOTATION_INFO (g_dbus_annotation_info_get_type ())
307
308GLIB_AVAILABLE_IN_ALL
309GType g_dbus_node_info_get_type (void) G_GNUC_CONST;
310GLIB_AVAILABLE_IN_ALL
311GType g_dbus_interface_info_get_type (void) G_GNUC_CONST;
312GLIB_AVAILABLE_IN_ALL
313GType g_dbus_method_info_get_type (void) G_GNUC_CONST;
314GLIB_AVAILABLE_IN_ALL
315GType g_dbus_signal_info_get_type (void) G_GNUC_CONST;
316GLIB_AVAILABLE_IN_ALL
317GType g_dbus_property_info_get_type (void) G_GNUC_CONST;
318GLIB_AVAILABLE_IN_ALL
319GType g_dbus_arg_info_get_type (void) G_GNUC_CONST;
320GLIB_AVAILABLE_IN_ALL
321GType g_dbus_annotation_info_get_type (void) G_GNUC_CONST;
322
323G_END_DECLS
324
325#endif /* __G_DBUS_INTROSPECTION_H__ */
326