Initial GDBus code-drop from GDBus-standalone repo
[platform/upstream/glib.git] / gio / gdbusintrospection.h
1 /* GDBus - GLib D-Bus Library
2  *
3  * Copyright (C) 2008-2009 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 #ifndef __G_DBUS_INTROSPECTION_H__
24 #define __G_DBUS_INTROSPECTION_H__
25
26 #include <gio/giotypes.h>
27
28 G_BEGIN_DECLS
29
30 /**
31  * GDBusAnnotationInfo:
32  * @ref_count: The reference count or -1 if statically allocated.
33  * @key: The name of the annotation, e.g. "org.freedesktop.DBus.Deprecated".
34  * @value: The value of the annotation.
35  * @annotations: A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
36  *
37  * Information about an annotation.
38  */
39 struct _GDBusAnnotationInfo
40 {
41   volatile gint         ref_count;
42   gchar                *key;
43   gchar                *value;
44   GDBusAnnotationInfo **annotations;
45 };
46
47 /**
48  * GDBusArgInfo:
49  * @ref_count: The reference count or -1 if statically allocated.
50  * @name: Name of the argument, e.g. @unix_user_id.
51  * @signature: D-Bus signature of the argument (a single complete type).
52  * @annotations: A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
53  *
54  * Information about an argument for a method or a signal.
55  */
56 struct _GDBusArgInfo
57 {
58   volatile gint         ref_count;
59   gchar                *name;
60   gchar                *signature;
61   GDBusAnnotationInfo **annotations;
62 };
63
64 /**
65  * GDBusMethodInfo:
66  * @ref_count: The reference count or -1 if statically allocated.
67  * @name: The name of the D-Bus method, e.g. @RequestName.
68  * @in_args: A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no in arguments.
69  * @out_args: A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no out arguments.
70  * @annotations: A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
71  *
72  * Information about a method on an D-Bus interface.
73  */
74 struct _GDBusMethodInfo
75 {
76   volatile gint         ref_count;
77   gchar                *name;
78   GDBusArgInfo        **in_args;
79   GDBusArgInfo        **out_args;
80   GDBusAnnotationInfo **annotations;
81 };
82
83 /**
84  * GDBusSignalInfo:
85  * @ref_count: The reference count or -1 if statically allocated.
86  * @name: The name of the D-Bus signal, e.g. "NameOwnerChanged".
87  * @args: A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no arguments.
88  * @annotations: A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
89  *
90  * Information about a signal on a D-Bus interface.
91  */
92 struct _GDBusSignalInfo
93 {
94   volatile gint         ref_count;
95   gchar                *name;
96   GDBusArgInfo        **args;
97   GDBusAnnotationInfo **annotations;
98 };
99
100 /**
101  * GDBusPropertyInfo:
102  * @ref_count: The reference count or -1 if statically allocated.
103  * @name: The name of the D-Bus property, e.g. "SupportedFilesystems".
104  * @signature: The D-Bus signature of the property (a single complete type).
105  * @flags: Access control flags for the property.
106  * @annotations: A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
107  *
108  * Information about a D-Bus property on a D-Bus interface.
109  */
110 struct _GDBusPropertyInfo
111 {
112   volatile gint             ref_count;
113   gchar                    *name;
114   gchar                    *signature;
115   GDBusPropertyInfoFlags    flags;
116   GDBusAnnotationInfo     **annotations;
117 };
118
119 /**
120  * GDBusInterfaceInfo:
121  * @ref_count: The reference count or -1 if statically allocated.
122  * @name: The name of the D-Bus interface, e.g. "org.freedesktop.DBus.Properties".
123  * @methods: A pointer to a %NULL-terminated array of pointers to #GDBusMethodInfo structures or %NULL if there are no methods.
124  * @signals: A pointer to a %NULL-terminated array of pointers to #GDBusSignalInfo structures or %NULL if there are no signals.
125  * @properties: A pointer to a %NULL-terminated array of pointers to #GDBusPropertyInfo structures or %NULL if there are no properties.
126  * @annotations: A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
127  *
128  * Information about a D-Bus interface.
129  */
130 struct _GDBusInterfaceInfo
131 {
132   volatile gint         ref_count;
133   gchar                *name;
134   GDBusMethodInfo     **methods;
135   GDBusSignalInfo     **signals;
136   GDBusPropertyInfo   **properties;
137   GDBusAnnotationInfo **annotations;
138 };
139
140 /**
141  * GDBusNodeInfo:
142  * @ref_count: The reference count or -1 if statically allocated.
143  * @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.
144  * @interfaces: A pointer to a %NULL-terminated array of pointers to #GDBusInterfaceInfo structures or %NULL if there are no interfaces.
145  * @nodes: A pointer to a %NULL-terminated array of pointers to #GDBusNodeInfo structures or %NULL if there are no nodes.
146  * @annotations: A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
147  *
148  * Information about nodes in a remote object hierarchy.
149  */
150 struct _GDBusNodeInfo
151 {
152   volatile gint         ref_count;
153   gchar                *path;
154   GDBusInterfaceInfo  **interfaces;
155   GDBusNodeInfo       **nodes;
156   GDBusAnnotationInfo **annotations;
157 };
158
159 const gchar              *g_dbus_annotation_info_lookup          (const GDBusAnnotationInfo **annotations,
160                                                                   const gchar               *name);
161 const GDBusMethodInfo    *g_dbus_interface_info_lookup_method    (const GDBusInterfaceInfo  *info,
162                                                                   const gchar               *name);
163 const GDBusSignalInfo    *g_dbus_interface_info_lookup_signal    (const GDBusInterfaceInfo  *info,
164                                                                   const gchar               *name);
165 const GDBusPropertyInfo  *g_dbus_interface_info_lookup_property  (const GDBusInterfaceInfo  *info,
166                                                                   const gchar               *name);
167 void                      g_dbus_interface_info_generate_xml     (const GDBusInterfaceInfo  *info,
168                                                                   guint                      indent,
169                                                                   GString                   *string_builder);
170
171 GDBusNodeInfo            *g_dbus_node_info_new_for_xml           (const gchar               *xml_data,
172                                                                   GError                   **error);
173 const GDBusInterfaceInfo *g_dbus_node_info_lookup_interface      (const GDBusNodeInfo       *info,
174                                                                   const gchar               *name);
175 void                      g_dbus_node_info_generate_xml          (const GDBusNodeInfo       *info,
176                                                                   guint                      indent,
177                                                                   GString                   *string_builder);
178
179 GDBusNodeInfo            *g_dbus_node_info_ref                   (GDBusNodeInfo             *info);
180 GDBusInterfaceInfo       *g_dbus_interface_info_ref              (GDBusInterfaceInfo        *info);
181 GDBusMethodInfo          *g_dbus_method_info_ref                 (GDBusMethodInfo           *info);
182 GDBusSignalInfo          *g_dbus_signal_info_ref                 (GDBusSignalInfo           *info);
183 GDBusPropertyInfo        *g_dbus_property_info_ref               (GDBusPropertyInfo         *info);
184 GDBusArgInfo             *g_dbus_arg_info_ref                    (GDBusArgInfo              *info);
185 GDBusAnnotationInfo      *g_dbus_annotation_info_ref             (GDBusAnnotationInfo       *info);
186
187 void                      g_dbus_node_info_unref                 (GDBusNodeInfo             *info);
188 void                      g_dbus_interface_info_unref            (GDBusInterfaceInfo        *info);
189 void                      g_dbus_method_info_unref               (GDBusMethodInfo           *info);
190 void                      g_dbus_signal_info_unref               (GDBusSignalInfo           *info);
191 void                      g_dbus_property_info_unref             (GDBusPropertyInfo         *info);
192 void                      g_dbus_arg_info_unref                  (GDBusArgInfo              *info);
193 void                      g_dbus_annotation_info_unref           (GDBusAnnotationInfo       *info);
194
195
196 /**
197  * G_TYPE_DBUS_NODE_INFO:
198  *
199  * The #GType for a boxed type holding a #GDBusNodeInfo.
200  */
201 #define G_TYPE_DBUS_NODE_INFO       (g_dbus_node_info_get_type ())
202
203 /**
204  * G_TYPE_DBUS_INTERFACE_INFO:
205  *
206  * The #GType for a boxed type holding a #GDBusInterfaceInfo.
207  */
208 #define G_TYPE_DBUS_INTERFACE_INFO  (g_dbus_interface_info_get_type ())
209
210 /**
211  * G_TYPE_DBUS_METHOD_INFO:
212  *
213  * The #GType for a boxed type holding a #GDBusMethodInfo.
214  */
215 #define G_TYPE_DBUS_METHOD_INFO     (g_dbus_method_info_get_type ())
216
217 /**
218  * G_TYPE_DBUS_SIGNAL_INFO:
219  *
220  * The #GType for a boxed type holding a #GDBusSignalInfo.
221  */
222 #define G_TYPE_DBUS_SIGNAL_INFO     (g_dbus_signal_info_get_type ())
223
224 /**
225  * G_TYPE_DBUS_PROPERTY_INFO:
226  *
227  * The #GType for a boxed type holding a #GDBusPropertyInfo.
228  */
229 #define G_TYPE_DBUS_PROPERTY_INFO   (g_dbus_property_info_get_type ())
230
231 /**
232  * G_TYPE_DBUS_ARG_INFO:
233  *
234  * The #GType for a boxed type holding a #GDBusArgInfo.
235  */
236 #define G_TYPE_DBUS_ARG_INFO        (g_dbus_arg_info_get_type ())
237
238 /**
239  * G_TYPE_DBUS_ANNOTATION_INFO:
240  *
241  * The #GType for a boxed type holding a #GDBusAnnotationInfo.
242  */
243 #define G_TYPE_DBUS_ANNOTATION_INFO (g_dbus_annotation_info_get_type ())
244
245 GType g_dbus_node_info_get_type       (void) G_GNUC_CONST;
246 GType g_dbus_interface_info_get_type  (void) G_GNUC_CONST;
247 GType g_dbus_method_info_get_type     (void) G_GNUC_CONST;
248 GType g_dbus_signal_info_get_type     (void) G_GNUC_CONST;
249 GType g_dbus_property_info_get_type   (void) G_GNUC_CONST;
250 GType g_dbus_arg_info_get_type        (void) G_GNUC_CONST;
251 GType g_dbus_annotation_info_get_type (void) G_GNUC_CONST;
252
253 G_END_DECLS
254
255 #endif /* __G_DBUS_INTROSPECTION_H__ */