Spying on the session bus using dbus_bus_add_match

Thiago Macieira thiago at kde.org
Tue Apr 14 05:47:04 PDT 2009


Em Terça-feira 14 Abril 2009, às 13:11:55, Ali Abdallah escreveu:
> Hi,
>
> I want to monitor some method calls send to particular name, say
> org.gnome.ScreenSaver, i'm interested in catching only inhibit messages
> sent to the screensaver interface, so i setup my filter function and all
> goes fine. my problem is in the return code of the filter function:
>
> If the return code DBUS_HANDLER_RESULT_NOT_YET_HANDLED sometimes when
> sending messages as test using dbus-send to that interface i receive
> org.freedesktop.DBus.Error.UnknownMethod: Method "GetSessionIdleTime"
> with signature "" on interface "org.gnome.ScreenSaver" doesn't exist.
>
> Why is that, the message should go also to the screensaver filter right!
>
> If i return DBUS_HANDLER_RESULT_HANDLED all goes fine, but i don't
> understand why!

If you add a filter rule, you're going to receive messages. And if you receive 
messages, you should handle them. If you receive a method call and nothing 
handles it, libdbus-1 sends an error message saying nothing did.

In theory, method calls are unicast: there's only one application interested 
in receiving them. That's why libdbus-1 has this behaviour.

You're spying, so there are two or more applications receiving the method 
call. The spy should say it handled the message so that no error reply is sent 
to the caller.

One more thing: you can't count on eavesdropping being allowed. Please 
redesign your application, since you may not receive any Inhibit calls through 
spying.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Software
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20090414/8db5d74d/attachment.pgp 


More information about the dbus mailing list