[systemd-devel] [RFC][PATCH] bus: Add destination field to sd_bus_message_new_signal() and sd_bus_emit_signal()

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Dec 5 05:09:14 PST 2013


On 05/12/13 12:13, Lukasz Skalski wrote:
> destination - the unique bus name for the destination for the signal
> or NULL to emit to all listeners.

This is rarely-needed functionality, but sometimes necessary. If anyone
is going to replicate the client-facing functionality of the dbus-daemon
using libsystemd-bus, you'll need this for NameAcquired and NameLost;
and I've seen other real-world APIs where unicast signals were also
desirable.

Depending where you want to be on a scale from "maximally flexible" to
"promote the common case, and make the rare case slightly tedious" you
could either add the parameter all the time as in Lucasz' patch, or go
for something more like this to encourage those in doubt to use the more
conventional broadcast signals:

int sd_bus_message_new_signal(sd_bus *bus,
    const char *path,
    const char *interface,
    const char *member,
    sd_bus_message **m);
int sd_bus_message_new_unicast_signal(sd_bus *bus,
    const char *destination, /* must be non-NULL */
    const char *path,
    const char *interface,
    const char *member,
    sd_bus_message **m);

Regards,
    S



More information about the systemd-devel mailing list