[fdo] DBUS workflow questions

Jason H jhihn at gmx.com
Wed Jun 16 15:10:44 UTC 2021


First, let me say that if this is not the correct list for this question, please accept my apologies. If there is a better list, I am all ears.

I've been aware of DBUS for years, but I have never developed any software that interfaces with it. I now find myself in that situation. The project I am on is using Qt, however a portion code I am to interface with is in libdbus/sdbus and is still being developed by others.From a workflow standpoint we couldn't be more different. I've got qdbusxml2cpp, they have been manually building messages in C, no XML. I'm looking for some way to provide a code-pipeline (compile time) enforcement of the agreed-to XML interface descriptions. I've been looking around and it looks as if there isn't this kind of interface enforcement? By "enforcement", I mean the messages they generate conform to the spec, and the services they provide conform to the spec.

If it is true that this level of enforcement doesn't exist, I'm kind-of surprised it doesn't already? I would figure that non-conforming clients could be bad actors, and that could lead to exploits. I would expect that the DBUS daemons could provide some enforcement at last, by proving the XML to the daemon and preventing dispatch of non-conforming messages?

Anyway getting back to the real issue:
I am looking for a way to have the messaging enforced and provide a positive developer experience.
What I would like:
1. Require a XML
2. Generate "friendly*" bindings for the XML via tool  (.h files, maybe stub C files too)
3. Have developers provide the implementation.

This way at least if the XML changes the header and implementation can differ and be caught by a compiler. I'm currently getting push-back from the C team who are ok wish publishing the XML, but want to do minimal amount of work to conform to the workflow. It's not an unreasonable request.

I hope I make sense. Thanks in advance.


*friendly: Like a dead simple function prototype that takes the parameters from the XML. Ex:
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/com/example/MyObject">
<interface name="com.example.MyObject">
<method name="ManyArgs">
<arg type="u" name="x" direction="in" />
<arg type="s" name="str" direction="in" />
<arg type="d" name="trouble" direction="in" />
<arg type="d" name="d_ret" direction="out" />
<arg type="s" name="str_ret" direction="out" />
</method>
</interface>
</node>

and have it generate:

void ManyArgs(dbus *handle, unsigned int x, std::string str, double trouble, double* d_ret, std::string *out);







More information about the freedesktop mailing list