gdbusintrospection: fix introspection of DBus Introspection structures
[platform/upstream/glib.git] / gio / gdbusintrospection.h
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 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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: David Zeuthen <davidz@redhat.com>
21  */
22
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
26
27 #ifndef __G_DBUS_INTROSPECTION_H__
28 #define __G_DBUS_INTROSPECTION_H__
29
30 #include <gio/giotypes.h>
31
32 G_BEGIN_DECLS
33
34 /**
35  * GDBusAnnotationInfo:
36  * @ref_count: The reference count or -1 if statically allocated.
37  * @key: The name of the annotation, e.g. "org.freedesktop.DBus.Deprecated".
38  * @value: The value of the annotation.
39  * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
40  *
41  * Information about an annotation.
42  *
43  * Since: 2.26
44  */
45 struct _GDBusAnnotationInfo
46 {
47   volatile gint         ref_count;
48   gchar                *key;
49   gchar                *value;
50   GDBusAnnotationInfo **annotations;
51 };
52
53 /**
54  * GDBusArgInfo:
55  * @ref_count: The reference count or -1 if statically allocated.
56  * @name: Name of the argument, e.g. @unix_user_id.
57  * @signature: D-Bus signature of the argument (a single complete type).
58  * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
59  *
60  * Information about an argument for a method or a signal.
61  *
62  * Since: 2.26
63  */
64 struct _GDBusArgInfo
65 {
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  */
84 struct _GDBusMethodInfo
85 {
86   volatile gint         ref_count;
87   gchar                *name;
88   GDBusArgInfo        **in_args;
89   GDBusArgInfo        **out_args;
90   GDBusAnnotationInfo **annotations;
91 };
92
93 /**
94  * GDBusSignalInfo:
95  * @ref_count: The reference count or -1 if statically allocated.
96  * @name: The name of the D-Bus signal, e.g. "NameOwnerChanged".
97  * @args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no arguments.
98  * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
99  *
100  * Information about a signal on a D-Bus interface.
101  *
102  * Since: 2.26
103  */
104 struct _GDBusSignalInfo
105 {
106   volatile gint         ref_count;
107   gchar                *name;
108   GDBusArgInfo        **args;
109   GDBusAnnotationInfo **annotations;
110 };
111
112 /**
113  * GDBusPropertyInfo:
114  * @ref_count: The reference count or -1 if statically allocated.
115  * @name: The name of the D-Bus property, e.g. "SupportedFilesystems".
116  * @signature: The D-Bus signature of the property (a single complete type).
117  * @flags: Access control flags for the property.
118  * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
119  *
120  * Information about a D-Bus property on a D-Bus interface.
121  *
122  * Since: 2.26
123  */
124 struct _GDBusPropertyInfo
125 {
126   volatile gint             ref_count;
127   gchar                    *name;
128   gchar                    *signature;
129   GDBusPropertyInfoFlags    flags;
130   GDBusAnnotationInfo     **annotations;
131 };
132
133 /**
134  * GDBusInterfaceInfo:
135  * @ref_count: The reference count or -1 if statically allocated.
136  * @name: The name of the D-Bus interface, e.g. "org.freedesktop.DBus.Properties".
137  * @methods: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusMethodInfo structures or %NULL if there are no methods.
138  * @signals: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusSignalInfo structures or %NULL if there are no signals.
139  * @properties: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusPropertyInfo structures or %NULL if there are no properties.
140  * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
141  *
142  * Information about a D-Bus interface.
143  *
144  * Since: 2.26
145  */
146 struct _GDBusInterfaceInfo
147 {
148   volatile gint         ref_count;
149   gchar                *name;
150   GDBusMethodInfo     **methods;
151   GDBusSignalInfo     **signals;
152   GDBusPropertyInfo   **properties;
153   GDBusAnnotationInfo **annotations;
154 };
155
156 /**
157  * GDBusNodeInfo:
158  * @ref_count: The reference count or -1 if statically allocated.
159  * @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.
160  * @interfaces: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusInterfaceInfo structures or %NULL if there are no interfaces.
161  * @nodes: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusNodeInfo structures or %NULL if there are no nodes.
162  * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
163  *
164  * Information about nodes in a remote object hierarchy.
165  *
166  * Since: 2.26
167  */
168 struct _GDBusNodeInfo
169 {
170   volatile gint         ref_count;
171   gchar                *path;
172   GDBusInterfaceInfo  **interfaces;
173   GDBusNodeInfo       **nodes;
174   GDBusAnnotationInfo **annotations;
175 };
176
177 const gchar        *g_dbus_annotation_info_lookup          (GDBusAnnotationInfo **annotations,
178                                                             const gchar          *name);
179 GDBusMethodInfo    *g_dbus_interface_info_lookup_method    (GDBusInterfaceInfo   *info,
180                                                             const gchar          *name);
181 GDBusSignalInfo    *g_dbus_interface_info_lookup_signal    (GDBusInterfaceInfo   *info,
182                                                             const gchar          *name);
183 GDBusPropertyInfo  *g_dbus_interface_info_lookup_property  (GDBusInterfaceInfo   *info,
184                                                             const gchar          *name);
185 void                g_dbus_interface_info_cache_build      (GDBusInterfaceInfo   *info);
186 void                g_dbus_interface_info_cache_release    (GDBusInterfaceInfo   *info);
187
188 void                g_dbus_interface_info_generate_xml     (GDBusInterfaceInfo   *info,
189                                                             guint                 indent,
190                                                             GString              *string_builder);
191
192 GDBusNodeInfo      *g_dbus_node_info_new_for_xml           (const gchar          *xml_data,
193                                                             GError              **error);
194 GDBusInterfaceInfo *g_dbus_node_info_lookup_interface      (GDBusNodeInfo        *info,
195                                                             const gchar          *name);
196 void                g_dbus_node_info_generate_xml          (GDBusNodeInfo        *info,
197                                                             guint                 indent,
198                                                             GString              *string_builder);
199
200 GDBusNodeInfo       *g_dbus_node_info_ref                  (GDBusNodeInfo        *info);
201 GDBusInterfaceInfo  *g_dbus_interface_info_ref             (GDBusInterfaceInfo   *info);
202 GDBusMethodInfo     *g_dbus_method_info_ref                (GDBusMethodInfo      *info);
203 GDBusSignalInfo     *g_dbus_signal_info_ref                (GDBusSignalInfo      *info);
204 GDBusPropertyInfo   *g_dbus_property_info_ref              (GDBusPropertyInfo    *info);
205 GDBusArgInfo        *g_dbus_arg_info_ref                   (GDBusArgInfo         *info);
206 GDBusAnnotationInfo *g_dbus_annotation_info_ref            (GDBusAnnotationInfo  *info);
207
208 void                 g_dbus_node_info_unref                (GDBusNodeInfo        *info);
209 void                 g_dbus_interface_info_unref           (GDBusInterfaceInfo   *info);
210 void                 g_dbus_method_info_unref              (GDBusMethodInfo      *info);
211 void                 g_dbus_signal_info_unref              (GDBusSignalInfo      *info);
212 void                 g_dbus_property_info_unref            (GDBusPropertyInfo    *info);
213 void                 g_dbus_arg_info_unref                 (GDBusArgInfo         *info);
214 void                 g_dbus_annotation_info_unref          (GDBusAnnotationInfo  *info);
215
216 /**
217  * G_TYPE_DBUS_NODE_INFO:
218  *
219  * The #GType for a boxed type holding a #GDBusNodeInfo.
220  *
221  * Since: 2.26
222  */
223 #define G_TYPE_DBUS_NODE_INFO       (g_dbus_node_info_get_type ())
224
225 /**
226  * G_TYPE_DBUS_INTERFACE_INFO:
227  *
228  * The #GType for a boxed type holding a #GDBusInterfaceInfo.
229  *
230  * Since: 2.26
231  */
232 #define G_TYPE_DBUS_INTERFACE_INFO  (g_dbus_interface_info_get_type ())
233
234 /**
235  * G_TYPE_DBUS_METHOD_INFO:
236  *
237  * The #GType for a boxed type holding a #GDBusMethodInfo.
238  *
239  * Since: 2.26
240  */
241 #define G_TYPE_DBUS_METHOD_INFO     (g_dbus_method_info_get_type ())
242
243 /**
244  * G_TYPE_DBUS_SIGNAL_INFO:
245  *
246  * The #GType for a boxed type holding a #GDBusSignalInfo.
247  *
248  * Since: 2.26
249  */
250 #define G_TYPE_DBUS_SIGNAL_INFO     (g_dbus_signal_info_get_type ())
251
252 /**
253  * G_TYPE_DBUS_PROPERTY_INFO:
254  *
255  * The #GType for a boxed type holding a #GDBusPropertyInfo.
256  *
257  * Since: 2.26
258  */
259 #define G_TYPE_DBUS_PROPERTY_INFO   (g_dbus_property_info_get_type ())
260
261 /**
262  * G_TYPE_DBUS_ARG_INFO:
263  *
264  * The #GType for a boxed type holding a #GDBusArgInfo.
265  *
266  * Since: 2.26
267  */
268 #define G_TYPE_DBUS_ARG_INFO        (g_dbus_arg_info_get_type ())
269
270 /**
271  * G_TYPE_DBUS_ANNOTATION_INFO:
272  *
273  * The #GType for a boxed type holding a #GDBusAnnotationInfo.
274  *
275  * Since: 2.26
276  */
277 #define G_TYPE_DBUS_ANNOTATION_INFO (g_dbus_annotation_info_get_type ())
278
279 GType g_dbus_node_info_get_type       (void) G_GNUC_CONST;
280 GType g_dbus_interface_info_get_type  (void) G_GNUC_CONST;
281 GType g_dbus_method_info_get_type     (void) G_GNUC_CONST;
282 GType g_dbus_signal_info_get_type     (void) G_GNUC_CONST;
283 GType g_dbus_property_info_get_type   (void) G_GNUC_CONST;
284 GType g_dbus_arg_info_get_type        (void) G_GNUC_CONST;
285 GType g_dbus_annotation_info_get_type (void) G_GNUC_CONST;
286
287 G_END_DECLS
288
289 #endif /* __G_DBUS_INTROSPECTION_H__ */