Spying on the session bus using dbus_bus_add_match

Thiago Macieira thiago at kde.org
Tue Apr 14 08:37:42 PDT 2009


Em Terça-feira 14 Abril 2009, às 15:13:22, você escreveu:
> >> 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.
> >  
>
> So in this case i shouldn't add an filter to an interface that i don't
> own, this is the clean way.

It's not a problem of interface.

The problem is intercepting method calls whose destination is not you. Method 
calls always have a destination.

-- 
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/50dbd101/attachment.pgp 


More information about the dbus mailing list