Integration / D Bus Interview Questions
How does D-Bus introspection work in practice?
In practice, introspection is a plain method call like any other: a client sends a method call to Introspect() on the org.freedesktop.DBus.Introspectable interface, targeting the object path it wants to learn about, and the service replies with an XML string describing that object.
<node> <interface name="org.freedesktop.NetworkManager.Device"> <method name="Disconnect"/> <property name="State" type="u" access="read"/> <signal name="StateChanged"> <arg name="new_state" type="u"/> </signal> </interface> </node>
The XML also lists any child object paths nested beneath the queried one, which is how tools like D-Feet let you browse an entire service's object tree interactively: introspect the root, follow a child node listed in the response, introspect that, and repeat.
Because this reply is generated dynamically by the service rather than hand-maintained documentation, it always reflects exactly what that running version of the service actually supports.
More Related questions...