summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-02-12 20:13:08 +0000
committerHavoc Pennington <hp@redhat.com>2005-02-12 20:13:08 +0000
commit85fb9ff93c91bc500b91759d044e3dfd951c7868 (patch)
treec4b05d06dac85497f1220bc8ccece3e25b968f4c
parent5b26893cdddddc82dd8d278b9f4bb449f9aac59e (diff)
2005-02-12 Havoc Pennington <hp@redhat.com>
* bus/driver.c (bus_driver_handle_introspect): add introspection for bus driver
-rw-r--r--ChangeLog5
-rw-r--r--bus/driver.c82
-rw-r--r--doc/dbus-specification.xml5
3 files changed, 92 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ad384a7a..d3581801 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2005-02-12 Havoc Pennington <hp@redhat.com>
+ * bus/driver.c (bus_driver_handle_introspect): add introspection
+ for bus driver
+
+2005-02-12 Havoc Pennington <hp@redhat.com>
+
* bus/driver.c: put the signature of each bus driver method in the
table of handlers and check it on incoming calls; this isn't
really useful, but going to add introspect support in a minute.
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, " </interface>\n"))
goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " <interface name=\"%s\">\n",
+ DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS))
+ goto oom;
+
+ i = 0;
+ while (i < _DBUS_N_ELEMENTS (message_handlers))
+ {
+ if (!_dbus_string_append_printf (&xml, " <method name=\"%s\">\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, " <arg direction=\"in\" type=\"string\"/>\n"))
+ goto oom;
+ if (!_dbus_string_append (&xml, " <arg direction=\"in\" type=\"uint32\"/>\n"))
+ goto oom;
+ }
+ else if (strcmp (message_handlers[i].in_args,
+ DBUS_TYPE_STRING_AS_STRING) == 0)
+ {
+ if (!_dbus_string_append (&xml, " <arg direction=\"in\" type=\"string\"/>\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, " <arg direction=\"out\" type=\"string\"/>\n"))
+ goto oom;
+ }
+ else if (strcmp (message_handlers[i].out_args,
+ DBUS_TYPE_BOOLEAN_AS_STRING) == 0)
+ {
+ if (!_dbus_string_append (&xml, " <arg direction=\"out\" type=\"boolean\"/>\n"))
+ goto oom;
+ }
+ else if (strcmp (message_handlers[i].out_args,
+ DBUS_TYPE_UINT32_AS_STRING) == 0)
+ {
+ if (!_dbus_string_append (&xml, " <arg direction=\"out\" type=\"uint32\"/>\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, " <arg direction=\"out\" type=\"string\"/>\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, " </method>\n"))
+ goto oom;
+
+ ++i;
+ }
+
+ if (!_dbus_string_append (&xml, " </interface>\n"))
+ goto oom;
if (!_dbus_string_append (&xml, "</node>\n"))
goto oom;
diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml
index a9492b96..3d6a207f 100644
--- a/doc/dbus-specification.xml
+++ b/doc/dbus-specification.xml
@@ -2374,6 +2374,11 @@
the deprecation status of the interface.
</para>
</listitem>
+ <listitem>
+ <para>
+ The "name" attribute on arguments is optional.
+ </para>
+ </listitem>
</itemizedlist>
</para>