1 /* GDBus - GLib D-Bus Library
3 * Copyright (C) 2008-2009 Red Hat, Inc.
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.
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.
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.
20 * Author: David Zeuthen <davidz@redhat.com>
28 #include "gdbusintrospection.h"
34 * SECTION:gdbusintrospection
35 * @title: Introspection XML
36 * @short_description: Parse and Generate Introspection XML
39 * Various data structures and convenience routines to parse and
40 * generate D-Bus introspection XML. Introspection information is
41 * used when registering objects with g_dbus_connection_register_object().
43 * The format of D-BUs introspection XML is specified in the
44 * <link linkend="http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format">D-Bus specification</link>.
47 /* ---------------------------------------------------------------------------------------------------- */
49 /* See also https://bugzilla.gnome.org/show_bug.cgi?id=449565 ... */
50 #define _MY_DEFINE_BOXED_TYPE(TypeName, type_name) \
52 type_name##_get_type (void) \
54 static volatile gsize type_volatile = 0; \
55 if (g_once_init_enter (&type_volatile)) \
57 GType type = g_boxed_type_register_static (g_intern_static_string (#TypeName), \
58 (GBoxedCopyFunc) type_name##_ref, \
59 (GBoxedFreeFunc) type_name##_unref); \
60 g_once_init_leave (&type_volatile, type); \
62 return (GType) type_volatile; \
65 _MY_DEFINE_BOXED_TYPE (GDBusNodeInfo, g_dbus_node_info);
66 _MY_DEFINE_BOXED_TYPE (GDBusInterfaceInfo, g_dbus_interface_info);
67 _MY_DEFINE_BOXED_TYPE (GDBusMethodInfo, g_dbus_method_info);
68 _MY_DEFINE_BOXED_TYPE (GDBusSignalInfo, g_dbus_signal_info);
69 _MY_DEFINE_BOXED_TYPE (GDBusPropertyInfo, g_dbus_property_info);
70 _MY_DEFINE_BOXED_TYPE (GDBusArgInfo, g_dbus_arg_info);
71 _MY_DEFINE_BOXED_TYPE (GDBusAnnotationInfo, g_dbus_annotation_info);
73 /* ---------------------------------------------------------------------------------------------------- */
77 /* stuff we are currently collecting */
82 GPtrArray *properties;
83 GPtrArray *interfaces;
85 GPtrArray *annotations;
87 /* A list of GPtrArray's containing annotations */
88 GSList *annotations_stack;
90 /* A list of GPtrArray's containing interfaces */
91 GSList *interfaces_stack;
93 /* A list of GPtrArray's containing nodes */
96 /* Whether the direction was "in" for last parsed arg */
97 gboolean last_arg_was_in;
99 /* Number of args currently being collected; used for assigning
100 * names to args without a "name" attribute
106 /* ---------------------------------------------------------------------------------------------------- */
109 * g_dbus_node_info_ref:
110 * @info: A #GDBusNodeInfo
112 * If @info is statically allocated does nothing. Otherwise increases
113 * the reference count.
115 * Returns: The same @info.
120 g_dbus_node_info_ref (GDBusNodeInfo *info)
122 if (info->ref_count == -1)
124 g_atomic_int_inc (&info->ref_count);
129 * g_dbus_interface_info_ref:
130 * @info: A #GDBusInterfaceInfo
132 * If @info is statically allocated does nothing. Otherwise increases
133 * the reference count.
135 * Returns: The same @info.
140 g_dbus_interface_info_ref (GDBusInterfaceInfo *info)
142 if (info->ref_count == -1)
144 g_atomic_int_inc (&info->ref_count);
149 * g_dbus_method_info_ref:
150 * @info: A #GDBusMethodInfo
152 * If @info is statically allocated does nothing. Otherwise increases
153 * the reference count.
155 * Returns: The same @info.
160 g_dbus_method_info_ref (GDBusMethodInfo *info)
162 if (info->ref_count == -1)
164 g_atomic_int_inc (&info->ref_count);
169 * g_dbus_signal_info_ref:
170 * @info: A #GDBusSignalInfo
172 * If @info is statically allocated does nothing. Otherwise increases
173 * the reference count.
175 * Returns: The same @info.
180 g_dbus_signal_info_ref (GDBusSignalInfo *info)
182 if (info->ref_count == -1)
184 g_atomic_int_inc (&info->ref_count);
189 * g_dbus_property_info_ref:
190 * @info: A #GDBusPropertyInfo
192 * If @info is statically allocated does nothing. Otherwise increases
193 * the reference count.
195 * Returns: The same @info.
200 g_dbus_property_info_ref (GDBusPropertyInfo *info)
202 if (info->ref_count == -1)
204 g_atomic_int_inc (&info->ref_count);
209 * g_dbus_arg_info_ref:
210 * @info: A #GDBusArgInfo
212 * If @info is statically allocated does nothing. Otherwise increases
213 * the reference count.
215 * Returns: The same @info.
220 g_dbus_arg_info_ref (GDBusArgInfo *info)
222 if (info->ref_count == -1)
224 g_atomic_int_inc (&info->ref_count);
229 * g_dbus_node_info_ref:
230 * @info: A #GDBusNodeInfo
232 * If @info is statically allocated does nothing. Otherwise increases
233 * the reference count.
235 * Returns: The same @info.
239 GDBusAnnotationInfo *
240 g_dbus_annotation_info_ref (GDBusAnnotationInfo *info)
242 if (info->ref_count == -1)
244 g_atomic_int_inc (&info->ref_count);
248 /* ---------------------------------------------------------------------------------------------------- */
251 free_null_terminated_array (gpointer array, GDestroyNotify unref_func)
257 for (n = 0; p[n] != NULL; n++)
263 * g_dbus_annotation_info_unref:
264 * @info: A #GDBusAnnotationInfo.
266 * If @info is statically allocated, does nothing. Otherwise decreases
267 * the reference count of @info. When its reference count drops to 0,
268 * the memory used is freed.
273 g_dbus_annotation_info_unref (GDBusAnnotationInfo *info)
275 if (info->ref_count == -1)
277 if (g_atomic_int_dec_and_test (&info->ref_count))
280 g_free (info->value);
281 free_null_terminated_array (info->annotations, (GDestroyNotify) g_dbus_annotation_info_unref);
287 * g_dbus_arg_info_unref:
288 * @info: A #GDBusArgInfo.
290 * If @info is statically allocated, does nothing. Otherwise decreases
291 * the reference count of @info. When its reference count drops to 0,
292 * the memory used is freed.
297 g_dbus_arg_info_unref (GDBusArgInfo *info)
299 if (info->ref_count == -1)
301 if (g_atomic_int_dec_and_test (&info->ref_count))
304 g_free (info->signature);
305 free_null_terminated_array (info->annotations, (GDestroyNotify) g_dbus_annotation_info_unref);
311 * g_dbus_method_info_unref:
312 * @info: A #GDBusMethodInfo.
314 * If @info is statically allocated, does nothing. Otherwise decreases
315 * the reference count of @info. When its reference count drops to 0,
316 * the memory used is freed.
321 g_dbus_method_info_unref (GDBusMethodInfo *info)
323 if (info->ref_count == -1)
325 if (g_atomic_int_dec_and_test (&info->ref_count))
328 free_null_terminated_array (info->in_args, (GDestroyNotify) g_dbus_arg_info_unref);
329 free_null_terminated_array (info->out_args, (GDestroyNotify) g_dbus_arg_info_unref);
330 free_null_terminated_array (info->annotations, (GDestroyNotify) g_dbus_annotation_info_unref);
336 * g_dbus_signal_info_unref:
337 * @info: A #GDBusSignalInfo.
339 * If @info is statically allocated, does nothing. Otherwise decreases
340 * the reference count of @info. When its reference count drops to 0,
341 * the memory used is freed.
346 g_dbus_signal_info_unref (GDBusSignalInfo *info)
348 if (info->ref_count == -1)
350 if (g_atomic_int_dec_and_test (&info->ref_count))
353 free_null_terminated_array (info->args, (GDestroyNotify) g_dbus_arg_info_unref);
354 free_null_terminated_array (info->annotations, (GDestroyNotify) g_dbus_annotation_info_unref);
360 * g_dbus_property_info_unref:
361 * @info: A #GDBusPropertyInfo.
363 * If @info is statically allocated, does nothing. Otherwise decreases
364 * the reference count of @info. When its reference count drops to 0,
365 * the memory used is freed.
370 g_dbus_property_info_unref (GDBusPropertyInfo *info)
372 if (info->ref_count == -1)
374 if (g_atomic_int_dec_and_test (&info->ref_count))
377 g_free (info->signature);
378 free_null_terminated_array (info->annotations, (GDestroyNotify) g_dbus_annotation_info_unref);
384 * g_dbus_interface_info_unref:
385 * @info: A #GDBusInterfaceInfo.
387 * If @info is statically allocated, does nothing. Otherwise decreases
388 * the reference count of @info. When its reference count drops to 0,
389 * the memory used is freed.
394 g_dbus_interface_info_unref (GDBusInterfaceInfo *info)
396 if (info->ref_count == -1)
398 if (g_atomic_int_dec_and_test (&info->ref_count))
401 free_null_terminated_array (info->methods, (GDestroyNotify) g_dbus_method_info_unref);
402 free_null_terminated_array (info->signals, (GDestroyNotify) g_dbus_signal_info_unref);
403 free_null_terminated_array (info->properties, (GDestroyNotify) g_dbus_property_info_unref);
404 free_null_terminated_array (info->annotations, (GDestroyNotify) g_dbus_annotation_info_unref);
410 * g_dbus_node_info_unref:
411 * @info: A #GDBusNodeInfo.
413 * If @info is statically allocated, does nothing. Otherwise decreases
414 * the reference count of @info. When its reference count drops to 0,
415 * the memory used is freed.
420 g_dbus_node_info_unref (GDBusNodeInfo *info)
422 if (info->ref_count == -1)
424 if (g_atomic_int_dec_and_test (&info->ref_count))
427 free_null_terminated_array (info->interfaces, (GDestroyNotify) g_dbus_interface_info_unref);
428 free_null_terminated_array (info->nodes, (GDestroyNotify) g_dbus_node_info_unref);
429 free_null_terminated_array (info->annotations, (GDestroyNotify) g_dbus_annotation_info_unref);
434 /* ---------------------------------------------------------------------------------------------------- */
437 g_dbus_annotation_info_set (ParseData *data,
438 GDBusAnnotationInfo *info,
441 GDBusAnnotationInfo **embedded_annotations)
446 info->key = g_strdup (key);
449 info->value = g_strdup (value);
451 if (embedded_annotations != NULL)
452 info->annotations = embedded_annotations;
456 g_dbus_arg_info_set (ParseData *data,
459 const gchar *signature,
460 GDBusAnnotationInfo **annotations)
464 /* name may be NULL - TODO: compute name? */
466 info->name = g_strdup (name);
468 if (signature != NULL)
469 info->signature = g_strdup (signature);
471 if (annotations != NULL)
472 info->annotations = annotations;
476 g_dbus_method_info_set (ParseData *data,
477 GDBusMethodInfo *info,
480 GDBusArgInfo **in_args,
482 GDBusArgInfo **out_args,
483 GDBusAnnotationInfo **annotations)
488 info->name = g_strdup (name);
490 if (in_num_args != 0)
492 //info->in_num_args = in_num_args;
493 info->in_args = in_args;
496 if (out_num_args != 0)
498 //info->out_num_args = out_num_args;
499 info->out_args = out_args;
502 if (annotations != NULL)
503 info->annotations = annotations;
507 g_dbus_signal_info_set (ParseData *data,
508 GDBusSignalInfo *info,
512 GDBusAnnotationInfo **annotations)
517 info->name = g_strdup (name);
521 //info->num_args = num_args;
525 if (annotations != NULL)
527 info->annotations = annotations;
532 g_dbus_property_info_set (ParseData *data,
533 GDBusPropertyInfo *info,
535 const gchar *signature,
536 GDBusPropertyInfoFlags flags,
537 GDBusAnnotationInfo **annotations)
542 info->name = g_strdup (name);
544 if (flags != G_DBUS_PROPERTY_INFO_FLAGS_NONE)
547 if (signature != NULL)
549 info->signature = g_strdup (signature);
552 if (annotations != NULL)
554 info->annotations = annotations;
559 g_dbus_interface_info_set (ParseData *data,
560 GDBusInterfaceInfo *info,
563 GDBusMethodInfo **methods,
565 GDBusSignalInfo **signals,
566 guint num_properties,
567 GDBusPropertyInfo **properties,
568 GDBusAnnotationInfo **annotations)
574 info->name = g_strdup (name);
577 if (num_methods != 0)
579 //info->num_methods = num_methods;
580 info->methods = methods;
583 if (num_signals != 0)
585 //info->num_signals = num_signals;
586 info->signals = signals;
589 if (num_properties != 0)
591 //info->num_properties = num_properties;
592 info->properties = properties;
595 if (annotations != NULL)
597 info->annotations = annotations;
602 g_dbus_node_info_set (ParseData *data,
605 guint num_interfaces,
606 GDBusInterfaceInfo **interfaces,
608 GDBusNodeInfo **nodes,
609 GDBusAnnotationInfo **annotations)
615 info->path = g_strdup (path);
616 /* TODO: relative / absolute path snafu */
619 if (num_interfaces != 0)
621 //info->num_interfaces = num_interfaces;
622 info->interfaces = interfaces;
627 //info->num_nodes = num_nodes;
631 if (annotations != NULL)
633 info->annotations = annotations;
638 /* ---------------------------------------------------------------------------------------------------- */
641 g_dbus_annotation_info_generate_xml (const GDBusAnnotationInfo *info,
643 GString *string_builder)
647 g_string_append_printf (string_builder, "%*s<annotation name=\"%s\" value=\"%s\"",
652 if (info->annotations == NULL)
654 g_string_append (string_builder, "/>\n");
658 g_string_append (string_builder, ">\n");
660 for (n = 0; info->annotations != NULL && info->annotations[n] != NULL; n++)
661 g_dbus_annotation_info_generate_xml (info->annotations[n],
665 g_string_append_printf (string_builder, "%*s</annotation>\n",
672 g_dbus_arg_info_generate_xml (const GDBusArgInfo *info,
674 const gchar *extra_attributes,
675 GString *string_builder)
679 g_string_append_printf (string_builder, "%*s<arg type=\"%s\"",
683 if (info->name != NULL)
684 g_string_append_printf (string_builder, " name=\"%s\"", info->name);
686 if (extra_attributes != NULL)
687 g_string_append_printf (string_builder, " %s", extra_attributes);
689 if (info->annotations == NULL)
691 g_string_append (string_builder, "/>\n");
695 g_string_append (string_builder, ">\n");
697 for (n = 0; info->annotations != NULL && info->annotations[n] != NULL; n++)
698 g_dbus_annotation_info_generate_xml (info->annotations[n],
702 g_string_append_printf (string_builder, "%*s</arg>\n", indent, "");
708 g_dbus_method_info_generate_xml (const GDBusMethodInfo *info,
710 GString *string_builder)
714 g_string_append_printf (string_builder, "%*s<method name=\"%s\"",
718 if (info->annotations == NULL && info->in_args == NULL && info->out_args == NULL)
720 g_string_append (string_builder, "/>\n");
724 g_string_append (string_builder, ">\n");
726 for (n = 0; info->annotations != NULL && info->annotations[n] != NULL; n++)
727 g_dbus_annotation_info_generate_xml (info->annotations[n],
731 for (n = 0; info->in_args != NULL && info->in_args[n] != NULL; n++)
732 g_dbus_arg_info_generate_xml (info->in_args[n],
737 for (n = 0; info->out_args != NULL && info->out_args[n] != NULL; n++)
738 g_dbus_arg_info_generate_xml (info->out_args[n],
743 g_string_append_printf (string_builder, "%*s</method>\n", indent, "");
748 g_dbus_signal_info_generate_xml (const GDBusSignalInfo *info,
750 GString *string_builder)
754 g_string_append_printf (string_builder, "%*s<signal name=\"%s\"",
758 if (info->annotations == NULL && info->args == NULL)
760 g_string_append (string_builder, "/>\n");
764 g_string_append (string_builder, ">\n");
766 for (n = 0; info->annotations != NULL && info->annotations[n] != NULL; n++)
767 g_dbus_annotation_info_generate_xml (info->annotations[n],
771 for (n = 0; info->args != NULL && info->args[n] != NULL; n++)
772 g_dbus_arg_info_generate_xml (info->args[n],
777 g_string_append_printf (string_builder, "%*s</signal>\n", indent, "");
782 g_dbus_property_info_generate_xml (const GDBusPropertyInfo *info,
784 GString *string_builder)
787 const gchar *access_string;
789 if ((info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) &&
790 (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE))
792 access_string = "readwrite";
794 else if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
796 access_string = "read";
798 else if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE)
800 access_string = "write";
804 g_assert_not_reached ();
807 g_string_append_printf (string_builder, "%*s<property type=\"%s\" name=\"%s\" access=\"%s\"",
813 if (info->annotations == NULL)
815 g_string_append (string_builder, "/>\n");
819 g_string_append (string_builder, ">\n");
821 for (n = 0; info->annotations != NULL && info->annotations[n] != NULL; n++)
822 g_dbus_annotation_info_generate_xml (info->annotations[n],
826 g_string_append_printf (string_builder, "%*s</property>\n", indent, "");
832 * g_dbus_interface_info_generate_xml:
833 * @info: A #GDBusNodeInfo
834 * @indent: Indentation level.
835 * @string_builder: A #GString to to append XML data to.
837 * Appends an XML representation of @info (and its children) to @string_builder.
839 * This function is typically used for generating introspection XML
840 * documents at run-time for handling the
841 * <literal>org.freedesktop.DBus.Introspectable.Introspect</literal>
847 g_dbus_interface_info_generate_xml (const GDBusInterfaceInfo *info,
849 GString *string_builder)
853 g_string_append_printf (string_builder, "%*s<interface name=\"%s\">\n",
857 for (n = 0; info->annotations != NULL && info->annotations[n] != NULL; n++)
858 g_dbus_annotation_info_generate_xml (info->annotations[n],
862 for (n = 0; info->methods != NULL && info->methods[n] != NULL; n++)
863 g_dbus_method_info_generate_xml (info->methods[n],
867 for (n = 0; info->signals != NULL && info->signals[n] != NULL; n++)
868 g_dbus_signal_info_generate_xml (info->signals[n],
872 for (n = 0; info->properties != NULL && info->properties[n] != NULL; n++)
873 g_dbus_property_info_generate_xml (info->properties[n],
877 g_string_append_printf (string_builder, "%*s</interface>\n", indent, "");
881 * g_dbus_node_info_generate_xml:
882 * @node_info: A #GDBusNodeInfo.
883 * @indent: Indentation level.
884 * @string_builder: A #GString to to append XML data to.
886 * Appends an XML representation of @node_info (and its children) to @string_builder.
888 * This function is typically used for generating introspection XML documents at run-time for
889 * handling the <literal>org.freedesktop.DBus.Introspectable.Introspect</literal> method.
894 g_dbus_node_info_generate_xml (const GDBusNodeInfo *node_info,
896 GString *string_builder)
900 g_string_append_printf (string_builder, "%*s<node", indent, "");
901 if (node_info->path != NULL)
902 g_string_append_printf (string_builder, " name=\"%s\"", node_info->path);
904 if (node_info->interfaces == NULL && node_info->nodes == NULL && node_info->annotations == NULL)
906 g_string_append (string_builder, "/>\n");
910 g_string_append (string_builder, ">\n");
912 for (n = 0; node_info->annotations != NULL && node_info->annotations[n] != NULL; n++)
913 g_dbus_annotation_info_generate_xml (node_info->annotations[n],
917 for (n = 0; node_info->interfaces != NULL && node_info->interfaces[n] != NULL; n++)
918 g_dbus_interface_info_generate_xml (node_info->interfaces[n],
922 for (n = 0; node_info->nodes != NULL && node_info->nodes[n] != NULL; n++)
923 g_dbus_node_info_generate_xml (node_info->nodes[n],
927 g_string_append_printf (string_builder, "%*s</node>\n", indent, "");
931 /* ---------------------------------------------------------------------------------------------------- */
933 static GDBusAnnotationInfo **
934 parse_data_steal_annotations (ParseData *data, guint *out_num_elements)
936 GDBusAnnotationInfo **ret;
937 if (out_num_elements != NULL)
938 *out_num_elements = data->annotations->len;
939 if (data->annotations == NULL)
943 g_ptr_array_add (data->annotations, NULL);
944 ret = (GDBusAnnotationInfo **) g_ptr_array_free (data->annotations, FALSE);
946 data->annotations = g_ptr_array_new ();
950 static GDBusArgInfo **
951 parse_data_steal_args (ParseData *data, guint *out_num_elements)
954 if (out_num_elements != NULL)
955 *out_num_elements = data->args->len;
956 if (data->args == NULL)
960 g_ptr_array_add (data->args, NULL);
961 ret = (GDBusArgInfo **) g_ptr_array_free (data->args, FALSE);
963 data->args = g_ptr_array_new ();
967 static GDBusArgInfo **
968 parse_data_steal_out_args (ParseData *data, guint *out_num_elements)
971 if (out_num_elements != NULL)
972 *out_num_elements = data->out_args->len;
973 if (data->out_args == NULL)
977 g_ptr_array_add (data->out_args, NULL);
978 ret = (GDBusArgInfo **) g_ptr_array_free (data->out_args, FALSE);
980 data->out_args = g_ptr_array_new ();
984 static GDBusMethodInfo **
985 parse_data_steal_methods (ParseData *data, guint *out_num_elements)
987 GDBusMethodInfo **ret;
988 if (out_num_elements != NULL)
989 *out_num_elements = data->methods->len;
990 if (data->methods == NULL)
994 g_ptr_array_add (data->methods, NULL);
995 ret = (GDBusMethodInfo **) g_ptr_array_free (data->methods, FALSE);
997 data->methods = g_ptr_array_new ();
1001 static GDBusSignalInfo **
1002 parse_data_steal_signals (ParseData *data, guint *out_num_elements)
1004 GDBusSignalInfo **ret;
1005 if (out_num_elements != NULL)
1006 *out_num_elements = data->signals->len;
1007 if (data->signals == NULL)
1011 g_ptr_array_add (data->signals, NULL);
1012 ret = (GDBusSignalInfo **) g_ptr_array_free (data->signals, FALSE);
1014 data->signals = g_ptr_array_new ();
1018 static GDBusPropertyInfo **
1019 parse_data_steal_properties (ParseData *data, guint *out_num_elements)
1021 GDBusPropertyInfo **ret;
1022 if (out_num_elements != NULL)
1023 *out_num_elements = data->properties->len;
1024 if (data->properties == NULL)
1028 g_ptr_array_add (data->properties, NULL);
1029 ret = (GDBusPropertyInfo **) g_ptr_array_free (data->properties, FALSE);
1031 data->properties = g_ptr_array_new ();
1035 static GDBusInterfaceInfo **
1036 parse_data_steal_interfaces (ParseData *data, guint *out_num_elements)
1038 GDBusInterfaceInfo **ret;
1039 if (out_num_elements != NULL)
1040 *out_num_elements = data->interfaces->len;
1041 if (data->interfaces == NULL)
1045 g_ptr_array_add (data->interfaces, NULL);
1046 ret = (GDBusInterfaceInfo **) g_ptr_array_free (data->interfaces, FALSE);
1048 data->interfaces = g_ptr_array_new ();
1052 static GDBusNodeInfo **
1053 parse_data_steal_nodes (ParseData *data, guint *out_num_elements)
1055 GDBusNodeInfo **ret;
1056 if (out_num_elements != NULL)
1057 *out_num_elements = data->nodes->len;
1058 if (data->nodes == NULL)
1062 g_ptr_array_add (data->nodes, NULL);
1063 ret = (GDBusNodeInfo **) g_ptr_array_free (data->nodes, FALSE);
1065 data->nodes = g_ptr_array_new ();
1069 /* ---------------------------------------------------------------------------------------------------- */
1072 parse_data_free_annotations (ParseData *data)
1074 if (data->annotations == NULL)
1076 g_ptr_array_foreach (data->annotations, (GFunc) g_dbus_annotation_info_unref, NULL);
1077 g_ptr_array_free (data->annotations, TRUE);
1078 data->annotations = NULL;
1082 parse_data_free_args (ParseData *data)
1084 if (data->args == NULL)
1086 g_ptr_array_foreach (data->args, (GFunc) g_dbus_arg_info_unref, NULL);
1087 g_ptr_array_free (data->args, TRUE);
1092 parse_data_free_out_args (ParseData *data)
1094 if (data->out_args == NULL)
1096 g_ptr_array_foreach (data->out_args, (GFunc) g_dbus_arg_info_unref, NULL);
1097 g_ptr_array_free (data->out_args, TRUE);
1098 data->out_args = NULL;
1102 parse_data_free_methods (ParseData *data)
1104 if (data->methods == NULL)
1106 g_ptr_array_foreach (data->methods, (GFunc) g_dbus_method_info_unref, NULL);
1107 g_ptr_array_free (data->methods, TRUE);
1108 data->methods = NULL;
1112 parse_data_free_signals (ParseData *data)
1114 if (data->signals == NULL)
1116 g_ptr_array_foreach (data->signals, (GFunc) g_dbus_signal_info_unref, NULL);
1117 g_ptr_array_free (data->signals, TRUE);
1118 data->signals = NULL;
1122 parse_data_free_properties (ParseData *data)
1124 if (data->properties == NULL)
1126 g_ptr_array_foreach (data->properties, (GFunc) g_dbus_property_info_unref, NULL);
1127 g_ptr_array_free (data->properties, TRUE);
1128 data->properties = NULL;
1132 parse_data_free_interfaces (ParseData *data)
1134 if (data->interfaces == NULL)
1136 g_ptr_array_foreach (data->interfaces, (GFunc) g_dbus_interface_info_unref, NULL);
1137 g_ptr_array_free (data->interfaces, TRUE);
1138 data->interfaces = NULL;
1142 parse_data_free_nodes (ParseData *data)
1144 if (data->nodes == NULL)
1146 g_ptr_array_foreach (data->nodes, (GFunc) g_dbus_node_info_unref, NULL);
1147 g_ptr_array_free (data->nodes, TRUE);
1151 /* ---------------------------------------------------------------------------------------------------- */
1153 static GDBusAnnotationInfo *
1154 parse_data_get_annotation (ParseData *data, gboolean create_new)
1157 g_ptr_array_add (data->annotations, g_new0 (GDBusAnnotationInfo, 1));
1158 return data->annotations->pdata[data->annotations->len - 1];
1161 static GDBusArgInfo *
1162 parse_data_get_arg (ParseData *data, gboolean create_new)
1165 g_ptr_array_add (data->args, g_new0 (GDBusArgInfo, 1));
1166 return data->args->pdata[data->args->len - 1];
1169 static GDBusArgInfo *
1170 parse_data_get_out_arg (ParseData *data, gboolean create_new)
1173 g_ptr_array_add (data->out_args, g_new0 (GDBusArgInfo, 1));
1174 return data->out_args->pdata[data->out_args->len - 1];
1177 static GDBusMethodInfo *
1178 parse_data_get_method (ParseData *data, gboolean create_new)
1181 g_ptr_array_add (data->methods, g_new0 (GDBusMethodInfo, 1));
1182 return data->methods->pdata[data->methods->len - 1];
1185 static GDBusSignalInfo *
1186 parse_data_get_signal (ParseData *data, gboolean create_new)
1189 g_ptr_array_add (data->signals, g_new0 (GDBusSignalInfo, 1));
1190 return data->signals->pdata[data->signals->len - 1];
1193 static GDBusPropertyInfo *
1194 parse_data_get_property (ParseData *data, gboolean create_new)
1197 g_ptr_array_add (data->properties, g_new0 (GDBusPropertyInfo, 1));
1198 return data->properties->pdata[data->properties->len - 1];
1201 static GDBusInterfaceInfo *
1202 parse_data_get_interface (ParseData *data, gboolean create_new)
1205 g_ptr_array_add (data->interfaces, g_new0 (GDBusInterfaceInfo, 1));
1206 return data->interfaces->pdata[data->interfaces->len - 1];
1209 static GDBusNodeInfo *
1210 parse_data_get_node (ParseData *data, gboolean create_new)
1213 g_ptr_array_add (data->nodes, g_new0 (GDBusNodeInfo, 1));
1214 return data->nodes->pdata[data->nodes->len - 1];
1217 /* ---------------------------------------------------------------------------------------------------- */
1220 parse_data_new (void)
1224 data = g_new0 (ParseData, 1);
1226 /* initialize arrays */
1227 parse_data_steal_annotations (data, NULL);
1228 parse_data_steal_args (data, NULL);
1229 parse_data_steal_out_args (data, NULL);
1230 parse_data_steal_methods (data, NULL);
1231 parse_data_steal_signals (data, NULL);
1232 parse_data_steal_properties (data, NULL);
1233 parse_data_steal_interfaces (data, NULL);
1234 parse_data_steal_nodes (data, NULL);
1240 parse_data_free (ParseData *data)
1244 /* free stack of annotation arrays */
1245 for (l = data->annotations_stack; l != NULL; l = l->next)
1247 GPtrArray *annotations = l->data;
1248 g_ptr_array_foreach (annotations, (GFunc) g_dbus_annotation_info_unref, NULL);
1249 g_ptr_array_free (annotations, TRUE);
1251 g_slist_free (data->annotations_stack);
1253 /* free stack of interface arrays */
1254 for (l = data->interfaces_stack; l != NULL; l = l->next)
1256 GPtrArray *interfaces = l->data;
1257 g_ptr_array_foreach (interfaces, (GFunc) g_dbus_interface_info_unref, NULL);
1258 g_ptr_array_free (interfaces, TRUE);
1260 g_slist_free (data->interfaces_stack);
1262 /* free stack of node arrays */
1263 for (l = data->nodes_stack; l != NULL; l = l->next)
1265 GPtrArray *nodes = l->data;
1266 g_ptr_array_foreach (nodes, (GFunc) g_dbus_node_info_unref, NULL);
1267 g_ptr_array_free (nodes, TRUE);
1269 g_slist_free (data->nodes_stack);
1271 /* free arrays (data->annotations, data->interfaces and data->nodes have been freed above) */
1272 parse_data_free_args (data);
1273 parse_data_free_out_args (data);
1274 parse_data_free_methods (data);
1275 parse_data_free_signals (data);
1276 parse_data_free_properties (data);
1281 /* ---------------------------------------------------------------------------------------------------- */
1284 parser_start_element (GMarkupParseContext *context,
1285 const gchar *element_name,
1286 const gchar **attribute_names,
1287 const gchar **attribute_values,
1291 ParseData *data = user_data;
1295 const gchar *access;
1296 const gchar *direction;
1305 stack = (GSList *) g_markup_parse_context_get_element_stack (context);
1307 /* ---------------------------------------------------------------------------------------------------- */
1308 if (strcmp (element_name, "node") == 0)
1310 if (!(g_slist_length (stack) >= 1 || strcmp (stack->next->data, "node") != 0))
1312 g_set_error_literal (error,
1314 G_MARKUP_ERROR_INVALID_CONTENT,
1315 "<node> elements can only be top-level or embedded in other <node> elements");
1319 if (!g_markup_collect_attributes (element_name,
1323 G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "name", &name,
1324 /* some hand-written introspection XML documents use this */
1325 G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "xmlns:doc", NULL,
1326 G_MARKUP_COLLECT_INVALID))
1329 g_dbus_node_info_set (data,
1330 parse_data_get_node (data, TRUE),
1336 /* push the currently retrieved interfaces and nodes on the stack and prepare new arrays */
1337 data->interfaces_stack = g_slist_prepend (data->interfaces_stack, data->interfaces);
1338 data->interfaces = NULL;
1339 parse_data_steal_interfaces (data, NULL);
1341 data->nodes_stack = g_slist_prepend (data->nodes_stack, data->nodes);
1343 parse_data_steal_nodes (data, NULL);
1346 /* ---------------------------------------------------------------------------------------------------- */
1347 else if (strcmp (element_name, "interface") == 0)
1349 if (g_slist_length (stack) < 2 || strcmp (stack->next->data, "node") != 0)
1351 g_set_error_literal (error,
1353 G_MARKUP_ERROR_INVALID_CONTENT,
1354 "<interface> elements can only be embedded in <node> elements");
1358 if (!g_markup_collect_attributes (element_name,
1362 G_MARKUP_COLLECT_STRING, "name", &name,
1363 G_MARKUP_COLLECT_INVALID))
1366 g_dbus_interface_info_set (data,
1367 parse_data_get_interface (data, TRUE),
1375 /* ---------------------------------------------------------------------------------------------------- */
1376 else if (strcmp (element_name, "method") == 0)
1378 if (g_slist_length (stack) < 2 || strcmp (stack->next->data, "interface") != 0)
1380 g_set_error_literal (error,
1382 G_MARKUP_ERROR_INVALID_CONTENT,
1383 "<method> elements can only be embedded in <interface> elements");
1387 if (!g_markup_collect_attributes (element_name,
1391 G_MARKUP_COLLECT_STRING, "name", &name,
1392 G_MARKUP_COLLECT_INVALID))
1395 g_dbus_method_info_set (data,
1396 parse_data_get_method (data, TRUE),
1405 /* ---------------------------------------------------------------------------------------------------- */
1406 else if (strcmp (element_name, "signal") == 0)
1408 if (g_slist_length (stack) < 2 || strcmp (stack->next->data, "interface") != 0)
1410 g_set_error_literal (error,
1412 G_MARKUP_ERROR_INVALID_CONTENT,
1413 "<signal> elements can only be embedded in <interface> elements");
1417 if (!g_markup_collect_attributes (element_name,
1421 G_MARKUP_COLLECT_STRING, "name", &name,
1422 G_MARKUP_COLLECT_INVALID))
1425 g_dbus_signal_info_set (data,
1426 parse_data_get_signal (data, TRUE),
1434 /* ---------------------------------------------------------------------------------------------------- */
1435 else if (strcmp (element_name, "property") == 0)
1437 GDBusPropertyInfoFlags flags;
1439 if (g_slist_length (stack) < 2 || strcmp (stack->next->data, "interface") != 0)
1441 g_set_error_literal (error,
1443 G_MARKUP_ERROR_INVALID_CONTENT,
1444 "<property> elements can only be embedded in <interface> elements");
1448 if (!g_markup_collect_attributes (element_name,
1452 G_MARKUP_COLLECT_STRING, "name", &name,
1453 G_MARKUP_COLLECT_STRING, "type", &type,
1454 G_MARKUP_COLLECT_STRING, "access", &access,
1455 G_MARKUP_COLLECT_INVALID))
1458 if (strcmp (access, "read") == 0)
1459 flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE;
1460 else if (strcmp (access, "write") == 0)
1461 flags = G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE;
1462 else if (strcmp (access, "readwrite") == 0)
1463 flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE;
1468 G_MARKUP_ERROR_INVALID_CONTENT,
1469 "Unknown value '%s' of access attribute for element <property>",
1474 g_dbus_property_info_set (data,
1475 parse_data_get_property (data, TRUE),
1482 /* ---------------------------------------------------------------------------------------------------- */
1483 else if (strcmp (element_name, "arg") == 0)
1488 if (g_slist_length (stack) < 2 ||
1489 (strcmp (stack->next->data, "method") != 0 &&
1490 strcmp (stack->next->data, "signal") != 0))
1492 g_set_error_literal (error,
1494 G_MARKUP_ERROR_INVALID_CONTENT,
1495 "<arg> elements can only be embedded in <method> or <signal> elements");
1499 if (!g_markup_collect_attributes (element_name,
1503 G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "name", &name,
1504 G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "direction", &direction,
1505 G_MARKUP_COLLECT_STRING, "type", &type,
1506 G_MARKUP_COLLECT_INVALID))
1510 if (direction != NULL)
1512 if (strcmp (direction, "in") == 0)
1514 else if (strcmp (direction, "out") == 0)
1520 G_MARKUP_ERROR_INVALID_CONTENT,
1521 "Unknown value '%s' of direction attribute",
1527 if (is_in && strcmp (stack->next->data, "signal") == 0)
1529 g_set_error_literal (error,
1531 G_MARKUP_ERROR_INVALID_CONTENT,
1532 "Only direction 'out' is allowed for <arg> elements embedded in <signal>");
1537 name_to_use = g_strdup_printf ("arg_%d", data->num_args);
1539 name_to_use = g_strdup (name);
1544 g_dbus_arg_info_set (data,
1545 parse_data_get_arg (data, TRUE),
1549 data->last_arg_was_in = TRUE;
1553 g_dbus_arg_info_set (data,
1554 parse_data_get_out_arg (data, TRUE),
1558 data->last_arg_was_in = FALSE;
1562 g_free (name_to_use);
1564 /* ---------------------------------------------------------------------------------------------------- */
1565 else if (strcmp (element_name, "annotation") == 0)
1567 if (g_slist_length (stack) < 2 ||
1568 (strcmp (stack->next->data, "node") != 0 &&
1569 strcmp (stack->next->data, "interface") != 0 &&
1570 strcmp (stack->next->data, "signal") != 0 &&
1571 strcmp (stack->next->data, "method") != 0 &&
1572 strcmp (stack->next->data, "property") != 0 &&
1573 strcmp (stack->next->data, "arg") != 0 &&
1574 strcmp (stack->next->data, "annotation") != 0))
1576 g_set_error_literal (error,
1578 G_MARKUP_ERROR_INVALID_CONTENT,
1579 "<annotation> elements can only be embedded in <node>, <interface>, <signal>, <method>, <property>, <arg> or <annotation> elements");
1583 if (!g_markup_collect_attributes (element_name,
1587 G_MARKUP_COLLECT_STRING, "name", &name,
1588 G_MARKUP_COLLECT_STRING, "value", &value,
1589 G_MARKUP_COLLECT_INVALID))
1592 g_dbus_annotation_info_set (data,
1593 parse_data_get_annotation (data, TRUE),
1598 /* ---------------------------------------------------------------------------------------------------- */
1601 /* don't bail on unknown elements; just ignore them */
1603 /* ---------------------------------------------------------------------------------------------------- */
1605 /* push the currently retrieved annotations on the stack and prepare a new one */
1606 data->annotations_stack = g_slist_prepend (data->annotations_stack, data->annotations);
1607 data->annotations = NULL;
1608 parse_data_steal_annotations (data, NULL);
1614 /* ---------------------------------------------------------------------------------------------------- */
1616 static GDBusAnnotationInfo **
1617 steal_annotations (ParseData *data)
1619 return parse_data_steal_annotations (data, NULL);
1624 parser_end_element (GMarkupParseContext *context,
1625 const gchar *element_name,
1629 ParseData *data = user_data;
1630 gboolean have_popped_annotations;
1632 have_popped_annotations = FALSE;
1634 if (strcmp (element_name, "node") == 0)
1637 guint num_interfaces;
1638 GDBusNodeInfo **nodes;
1639 GDBusInterfaceInfo **interfaces;
1641 nodes = parse_data_steal_nodes (data, &num_nodes);
1642 interfaces = parse_data_steal_interfaces (data, &num_interfaces);
1644 /* destroy the nodes, interfaces for scope we're exiting and and pop the nodes, interfaces from the
1645 * scope we're reentering
1647 parse_data_free_interfaces (data);
1648 data->interfaces = (GPtrArray *) data->interfaces_stack->data;
1649 data->interfaces_stack = g_slist_remove (data->interfaces_stack, data->interfaces_stack->data);
1651 parse_data_free_nodes (data);
1652 data->nodes = (GPtrArray *) data->nodes_stack->data;
1653 data->nodes_stack = g_slist_remove (data->nodes_stack, data->nodes_stack->data);
1655 g_dbus_node_info_set (data,
1656 parse_data_get_node (data, FALSE),
1662 steal_annotations (data));
1665 else if (strcmp (element_name, "interface") == 0)
1669 guint num_properties;
1670 GDBusMethodInfo **methods;
1671 GDBusSignalInfo **signals;
1672 GDBusPropertyInfo **properties;
1674 methods = parse_data_steal_methods (data, &num_methods);
1675 signals = parse_data_steal_signals (data, &num_signals);
1676 properties = parse_data_steal_properties (data, &num_properties);
1678 g_dbus_interface_info_set (data,
1679 parse_data_get_interface (data, FALSE),
1687 steal_annotations (data));
1690 else if (strcmp (element_name, "method") == 0)
1694 GDBusArgInfo **in_args;
1695 GDBusArgInfo **out_args;
1697 in_args = parse_data_steal_args (data, &in_num_args);
1698 out_args = parse_data_steal_out_args (data, &out_num_args);
1700 g_dbus_method_info_set (data,
1701 parse_data_get_method (data, FALSE),
1707 steal_annotations (data));
1709 else if (strcmp (element_name, "signal") == 0)
1712 GDBusArgInfo **args;
1714 args = parse_data_steal_out_args (data, &num_args);
1716 g_dbus_signal_info_set (data,
1717 parse_data_get_signal (data, FALSE),
1721 steal_annotations (data));
1723 else if (strcmp (element_name, "property") == 0)
1725 g_dbus_property_info_set (data,
1726 parse_data_get_property (data, FALSE),
1729 G_DBUS_PROPERTY_INFO_FLAGS_NONE,
1730 steal_annotations (data));
1732 else if (strcmp (element_name, "arg") == 0)
1734 g_dbus_arg_info_set (data,
1735 data->last_arg_was_in ? parse_data_get_arg (data, FALSE) : parse_data_get_out_arg (data, FALSE),
1738 steal_annotations (data));
1740 else if (strcmp (element_name, "annotation") == 0)
1742 GDBusAnnotationInfo **embedded_annotations;
1744 embedded_annotations = steal_annotations (data);
1746 /* destroy the annotations for scope we're exiting and and pop the annotations from the scope we're reentering */
1747 parse_data_free_annotations (data);
1748 data->annotations = (GPtrArray *) data->annotations_stack->data;
1749 data->annotations_stack = g_slist_remove (data->annotations_stack, data->annotations_stack->data);
1751 have_popped_annotations = TRUE;
1753 g_dbus_annotation_info_set (data,
1754 parse_data_get_annotation (data, FALSE),
1757 embedded_annotations);
1761 /* don't bail on unknown elements; just ignore them */
1764 if (!have_popped_annotations)
1766 /* destroy the annotations for scope we're exiting and and pop the annotations from the scope we're reentering */
1767 parse_data_free_annotations (data);
1768 data->annotations = (GPtrArray *) data->annotations_stack->data;
1769 data->annotations_stack = g_slist_remove (data->annotations_stack, data->annotations_stack->data);
1773 /* ---------------------------------------------------------------------------------------------------- */
1776 parser_error (GMarkupParseContext *context,
1783 g_markup_parse_context_get_position (context, &line_number, &char_number);
1785 g_prefix_error (&error, "%d:%d: ",
1790 /* ---------------------------------------------------------------------------------------------------- */
1793 * g_dbus_node_info_new_for_xml:
1794 * @xml_data: Valid D-Bus introspection XML.
1795 * @error: Return location for error.
1797 * Parses @xml_data and returns a #GDBusNodeInfo representing the data.
1799 * Returns: A #GDBusNodeInfo structure or %NULL if @error is set. Free
1800 * with g_dbus_node_info_unref().
1805 g_dbus_node_info_new_for_xml (const gchar *xml_data,
1809 GMarkupParseContext *context;
1810 GMarkupParser *parser;
1818 parser = g_new0 (GMarkupParser, 1);
1819 parser->start_element = parser_start_element;
1820 parser->end_element = parser_end_element;
1821 parser->error = parser_error;
1823 data = parse_data_new ();
1824 context = g_markup_parse_context_new (parser,
1827 (GDestroyNotify) parse_data_free);
1829 if (!g_markup_parse_context_parse (context,
1835 GDBusNodeInfo **ughret;
1836 ughret = parse_data_steal_nodes (data, &num_nodes);
1844 G_MARKUP_ERROR_INVALID_CONTENT,
1845 "Expected a single node in introspection XML, found %d",
1849 for (n = 0; n < num_nodes; n++)
1851 for (n = 0; n < num_nodes; n++)
1852 g_dbus_node_info_unref (&(ret[n]));
1864 if (context != NULL)
1865 g_markup_parse_context_free (context);
1870 /* ---------------------------------------------------------------------------------------------------- */
1873 * g_dbus_annotation_info_lookup:
1874 * @annotations: A %NULL-terminated array of annotations or %NULL.
1875 * @name: The name of the annotation to look up.
1877 * Looks up the value of an annotation.
1879 * This cost of this function is O(n) in number of annotations.
1881 * Returns: The value or %NULL if not found. Do not free, it is owned by @annotations.
1886 g_dbus_annotation_info_lookup (const GDBusAnnotationInfo **annotations,
1893 for (n = 0; annotations != NULL && annotations[n]->key != NULL; n++)
1895 if (g_strcmp0 (annotations[n]->key, name) == 0)
1897 ret = annotations[n]->value;
1906 /* ---------------------------------------------------------------------------------------------------- */
1909 * g_dbus_interface_info_lookup_method:
1910 * @info: A #GDBusInterfaceInfo.
1911 * @name: A D-Bus method name (typically in CamelCase)
1913 * Looks up information about a method.
1915 * This cost of this function is O(n) in number of methods.
1917 * Returns: A #GDBusMethodInfo or %NULL if not found. Do not free, it is owned by @info.
1921 const GDBusMethodInfo *
1922 g_dbus_interface_info_lookup_method (const GDBusInterfaceInfo *info,
1926 const GDBusMethodInfo *result;
1928 for (n = 0; info->methods != NULL && info->methods[n] != NULL; n++)
1930 const GDBusMethodInfo *i = info->methods[n];
1932 if (g_strcmp0 (i->name, name) == 0)
1945 /* ---------------------------------------------------------------------------------------------------- */
1948 * g_dbus_interface_info_lookup_signal:
1949 * @info: A #GDBusInterfaceInfo.
1950 * @name: A D-Bus signal name (typically in CamelCase)
1952 * Looks up information about a signal.
1954 * This cost of this function is O(n) in number of signals.
1956 * Returns: A #GDBusSignalInfo or %NULL if not found. Do not free, it is owned by @info.
1960 const GDBusSignalInfo *
1961 g_dbus_interface_info_lookup_signal (const GDBusInterfaceInfo *info,
1965 const GDBusSignalInfo *result;
1967 for (n = 0; info->signals != NULL && info->signals[n] != NULL; n++)
1969 const GDBusSignalInfo *i = info->signals[n];
1971 if (g_strcmp0 (i->name, name) == 0)
1984 /* ---------------------------------------------------------------------------------------------------- */
1987 * g_dbus_interface_info_lookup_property:
1988 * @info: A #GDBusInterfaceInfo.
1989 * @name: A D-Bus property name (typically in CamelCase).
1991 * Looks up information about a property.
1993 * This cost of this function is O(n) in number of properties.
1995 * Returns: A #GDBusPropertyInfo or %NULL if not found. Do not free, it is owned by @info.
1999 const GDBusPropertyInfo *
2000 g_dbus_interface_info_lookup_property (const GDBusInterfaceInfo *info,
2004 const GDBusPropertyInfo *result;
2006 for (n = 0; info->properties != NULL && info->properties[n] != NULL; n++)
2008 const GDBusPropertyInfo *i = info->properties[n];
2010 if (g_strcmp0 (i->name, name) == 0)
2023 /* ---------------------------------------------------------------------------------------------------- */
2026 * g_dbus_node_info_lookup_interface:
2027 * @node_info: A #GDBusNodeInfo.
2028 * @name: A D-Bus interface name.
2030 * Looks up information about an interface.
2032 * This cost of this function is O(n) in number of interfaces.
2034 * Returns: A #GDBusInterfaceInfo or %NULL if not found. Do not free, it is owned by @node_info.
2038 const GDBusInterfaceInfo *
2039 g_dbus_node_info_lookup_interface (const GDBusNodeInfo *node_info,
2043 const GDBusInterfaceInfo *result;
2045 for (n = 0; node_info->interfaces != NULL && node_info->interfaces[n] != NULL; n++)
2047 const GDBusInterfaceInfo *i = node_info->interfaces[n];
2049 if (g_strcmp0 (i->name, name) == 0)
2062 #define __G_DBUS_INTROSPECTION_C__
2063 #include "gioaliasdef.c"