From 85fb9ff93c91bc500b91759d044e3dfd951c7868 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 12 Feb 2005 20:13:08 +0000 Subject: 2005-02-12 Havoc Pennington * bus/driver.c (bus_driver_handle_introspect): add introspection for bus driver --- bus/driver.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) (limited to 'bus') diff --git a/bus/driver.c b/bus/driver.c index 2eb505c1..7a716824 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -1094,6 +1094,7 @@ bus_driver_handle_introspect (DBusConnection *connection, DBusString xml; DBusMessage *reply; const char *v_STRING; + int i; _dbus_verbose ("Introspect() on bus driver\n"); @@ -1128,6 +1129,87 @@ bus_driver_handle_introspect (DBusConnection *connection, goto oom; if (!_dbus_string_append (&xml, " \n")) goto oom; + + if (!_dbus_string_append_printf (&xml, " \n", + DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS)) + goto oom; + + i = 0; + while (i < _DBUS_N_ELEMENTS (message_handlers)) + { + if (!_dbus_string_append_printf (&xml, " \n", + message_handlers[i].name)) + goto oom; + + /* This hacky mess can probably get mopped up eventually when the + * introspection format is related to the signature format + */ + + if (strcmp (message_handlers[i].in_args, "") == 0) + ; + else if (strcmp (message_handlers[i].in_args, + DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_UINT32_AS_STRING) == 0) + { + if (!_dbus_string_append (&xml, " \n")) + goto oom; + if (!_dbus_string_append (&xml, " \n")) + goto oom; + } + else if (strcmp (message_handlers[i].in_args, + DBUS_TYPE_STRING_AS_STRING) == 0) + { + if (!_dbus_string_append (&xml, " \n")) + goto oom; + } + else + { + _dbus_warn ("Lack introspection code for in sig '%s'\n", + message_handlers[i].in_args); + _dbus_assert_not_reached ("FIXME introspection missing"); + } + + if (strcmp (message_handlers[i].out_args, "") == 0) + ; + else if (strcmp (message_handlers[i].out_args, + DBUS_TYPE_STRING_AS_STRING) == 0) + { + if (!_dbus_string_append (&xml, " \n")) + goto oom; + } + else if (strcmp (message_handlers[i].out_args, + DBUS_TYPE_BOOLEAN_AS_STRING) == 0) + { + if (!_dbus_string_append (&xml, " \n")) + goto oom; + } + else if (strcmp (message_handlers[i].out_args, + DBUS_TYPE_UINT32_AS_STRING) == 0) + { + if (!_dbus_string_append (&xml, " \n")) + goto oom; + } + else if (strcmp (message_handlers[i].out_args, + DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING) == 0) + { + /* FIXME introspection format doesn't handle arrays yet */ + if (!_dbus_string_append (&xml, " \n")) + goto oom; + } + else + { + _dbus_warn ("Lack introspection code for out sig '%s'\n", + message_handlers[i].out_args); + _dbus_assert_not_reached ("FIXME introspection missing"); + } + + if (!_dbus_string_append (&xml, " \n")) + goto oom; + + ++i; + } + + if (!_dbus_string_append (&xml, " \n")) + goto oom; if (!_dbus_string_append (&xml, "\n")) goto oom; -- cgit v1.2.3