RFC: arg0array= matches
Lennart Poettering
mzqohf at 0pointer.de
Wed Apr 29 07:10:59 PDT 2015
Heya,
I'd like to add a new match expression "arg<n>array=" to dbus. It
would work like "arg<n>=" but test a string against an array of
strings.
The usecase for this is this: we'd like to move udev to use dbus as
transport. To make this efficient we need a way to match device
announcements. One of the most common matches in old udev was to
subscribe to all devices that carry a certain "tag", where "tag" is a
short string that devices can be labelled with. A typical device may
carry 0, 1 or more tags, and they are included as a list in each
announcement message.
Example: let's say we send out NewDevice signals each time a new
device appears, and NewDevice contains as first parameter the tags of
the device, followed by some more stuff, then we could install the
following match from a client that wants to get notified of all
devices tagged with the tag "seat7" (which is a tag that logind tags
devices belonging to a seat "seat7" with):
type='signal',sender='org.freedesktop.devices1',interface='org.freedesktop.devices1.Manager',member='NewDevice',arg0array='seat7'
The signal would then have a signature starting with "as". A signal
sent out with ["foobar", "waldo"] as this string array would not be
matched by the expression. A signal with ["miau", "kikiriki", "seat7",
"wuffwuff" ] otoh would match.
The syntax "arg0array=" takes inspiration from the match types
"arg0path=", "arg0namespace=".
Before I cook up a patch for the dbus spec for this, any opinions on
this?
Lennart
--
Lennart Poettering, Red Hat
More information about the dbus
mailing list