gdbus-monitor - interface ``

2019-09-06 11:19发布

问题:

Has the interface <none> in the gdbus-monitor output a special meaning?

What API call is required to create such a message using GDbus (g_dbus_connection_register_object does not allow to pass NULL as GDBusInterfaceInfo * and that seems to be the only to register a object to a path)

related: dbus - register object to remote on interface NULL

回答1:

Looking into dbus-monitor's source code shows that it occures as soon as DBUS_EXPORT const char * dbus_message_get_interface ( DBusMessage * message ) returns NULL (which is valid!, but not according to the spec which requires minimum one . and two name chunks!! EDIT: A noteable exception are method calls which do not require the interface field of a message to be set http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-types).


g_dbus_message_new_method_call (...) allows interface_ to be null. But that still only solves half the problems (sender). The receiver method seems to not exist for interface_s being NULL.


Turns out it is a bug, I did a source code investigation and filed a bug (including fix) https://bugzilla.gnome.org/show_bug.cgi?id=706675



回答2:

client needs to know the interface name while subscribing g_dbus_connection_signal_subscribe to any signal else it will listen to all interfaces hence inefficient. Interface is required to bind methods and signals in single entity mentioned in server introspection xml file.



标签: glib dbus gdbus