Pure Python dbus-monitor implementation (w/o using libdbus)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Pure Python dbus-monitor implementation (w/o using libdbus)

Jakub Piotr Cłapa-2
So here is the thing I was trying to scare you ;) with --- a pure Python
DBus implementation together with a rather simple (it's just the debug
mode I created while coding it) dbus-monitor. It connects to the bus
(defaults to session bus but you could very easily change it to connect
to any other address), sends Hello and AddMatch and displays everything
that's coming from the bus.

It's better than dbus-monitor because it decodes every possible dbus
message (it's not ,,too dumb'' for any signature) but on the other hand
it's really experimental, purely coded (I'm proud of about 3/4 of the
code, the rest is sometimes really messy) and possibly contains bugs.
The good part is that it's 200Kb of easily readable (I hope) and quite
heavily commented Python code and contains an almost fully featured
protocol implementation with SASL authorization, Unmarshaling (these two
are the ones I am proud of ;) and Marshaling.

It doesn't have any external dependencies (ok, it shouldn't, I may have
missed something :) and works out of the box (it doesn't even know how
to install itself, let alone requiring it ;).

It lacks much convenience code and is quite low-level but AFAI-tested-it
works[1].

I would be really happy if it proved useful to anyone (although I don't
expect much since the silence I got after the previous email ;). I could
  clean it up, fix any errors and maintain it (if there is any demand)
but probably only after Google's Summer of Code ends and I finally get
some rest.

[1] It can successfully pass (send and receive) a structure like the one
     below which is sadly not possible with current Python bindings (they
     lack Variant (could be worked-around by using Structs instead of
     Arrays) and for unknown reason send only half of this message).

     Yes, this is complete XML (with all namespaces resolved):

   (
    ['jabber:x:delay', 'http://pyxmpp.jabberstudio.org/xmlns/common'],
    (
     '1:presence',
     {':to': '[hidden email]/home/Bot', ':from':
'[hidden email]/home/Psi'},
     [
      Variant ('\n'),
      Variant (
       (
        '0:x',
        {':stamp': '20050810T19:10:45', ':from':
'[hidden email]/home/Psi'},
        []
       )
      ),
      Variant (
       (
        '1:show',
        {},
        [
         Variant ('dnd')
        ]
       )
      ),
      Variant ('\n'),
      Variant (
       (
        '1:status',
        {},
        [
         Variant ("I'm in love, not accidentally... :*\nWork... :)")
        ]
       )
      ),
      Variant ('\n'),
      Variant (
       (
        '1:priority',
        {},
        [
         Variant ('5')
        ]
       )
      ),
      Variant ('\n')
     ]
    )
   )

--
z wyrazami szacunku,
Jakub Piotr Cłapa
--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus
Reply | Threaded
Open this post in threaded view
|

Re: Pure Python dbus-monitor implementation (w/o using libdbus)

Jakub Piotr Cłapa-2
Oh, and yes... the link! ;]

http://zenburn.net/~jpc/dbus/dbus-monitor-2005-08-11.tar.bz2

--
Regards,
Jakub Piotr Cłapa
--
dbus mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/dbus