[avahi] Some notes on designing the Avahi DBUS API

Lennart Poettering mzzhgg at 0pointer.de
Fri Jun 24 13:20:29 PDT 2005


(Sebastien, I am CC'ing this to you, since you seem to be interested
in working on the DBUS stuff, too.)

Just some quick notes on which avahi-core API functions should be
exported over DBUS and which should not:

There are a bunch of functions which may be used to add low-level RRs
to the server. While they are useful when writing applications that
link directly against avahi-core, I doubt that it makes sense to
export them via DBUS to application developers. This would only
complicate things and induce abuse.

Those functions are:

On the other hand, the useful functions of style avahi_server_add_xxx() are:
        (though this may be ommited, since noone should use this
        anyway. For local addresses the avahi stack is much better in
        registering addresses, and registering remote addresses is a
        bad idea. The Apple API supports this function nonetheless, so
        we should do so as well)

        These functions are essentially the same, just with different
        arguments, only one should be really used.

On the browsing side, the following functions should be hidden from
the user:

The useful functions are:

The avahi_entry_group_xxx stuff must be available to the client, it is very
important for multi-protocol software. And it's the only way to be
notified of conflicts of user generated RRs.

The following functions should NOT be available to the clients:

Though avahi_server_new() shouldn't be exported to the clients (there
should be only one instance of this thing which is maintained by the
daemon anyway) the events that are dispatched by the callback
function attached to a server object should be forwarded to the
clients, (probably in terms of "DBUS signals").

The following functions are useful to clients and should be exported:

    avahi_server_get_{host_name,domain_name, host_name_fqdn}()

And that's it.    
If we limit the DBUS API to these functions there should be no need to
have rr.h available on the client side. The strlst stuff (which I have
recently documented in doxygen) is probably easily mapped to a DBUS
array of strings, so the should no real need for this on the client
side as well (though it makes some sense to have it, simply because it
makes construction of TXT data easy). To ease the use of DBUS
withouht libavahi-client it might make sense to pass IP addresses as
formatted ascii strings. (its easy to parse this on the server side
using avahi_address_parse())

So I'd suggest the following C-to-DBUS type mappings:

   AvahiAddress => STRING
   AvahiIfIndex => INT32
   AvahiProtocol => UINT8

All other mappings should be trivial.

I hope these notes help you to get the DBUS stuff quickly into a
usable state. 

BTW: Do you know a tool which i can easily use to get a list of
available DBUS services on the system?

I made a bunch of smaller changes to the current SVN to match the
updated RFC. Due to this the core might be a bit unstable now. The
avahi-core API has changed a bit too, so be warned... My TODO list for
bringing avahi up to the level of the new RFC just contains 4 points
now (from originally 12).


name { Lennart Poettering } loc { Hamburg - Germany }
mail { mzft (at) 0pointer (dot) de } gpg { 1A015CC4 }  
www { http://0pointer.de/lennart/ } icq# { 11060553 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/avahi/attachments/20050624/803d4db3/attachment.pgp

More information about the avahi mailing list