[avahi] D-Bus Connection with avahi

Lennart Poettering lennart at poettering.net
Tue Feb 12 06:25:27 PST 2008


On Wed, 30.01.08 10:50, Marco Franke (Real-Franky at gmx.de) wrote:

> Good morning,
> 
> I want to write a small programm which comunicates with avahi over DBus. I want to create a service and I want to listen on services in network.
> 
> I have searched in your doku and in your source files but I have not founded the D-Bus method to create a service and the
> method to listen.
> 
> There are D-Bus functions, which need as parameters the interface, the protocols and the aprotocol as integers. 
> Where can I read which numbers is for what?

This is unfortunately not documented. Patches welcome.

The avahi-python bindings contain a listing of all necessary codes.

Also, the C API is mostly a 1:1 wrapper of the D-Bus API, so it should
be fairly easy to extract to appropriate enums from
avahi-common/defs.h and avahi-common/address.h.

The interface parameter just takes a system interface number. As
returned by if_nametoindex(). Use -1 if you want to register a service
on all interfaces at the same time (which is what most apps probably
want to do). protocol and aprptocol use the enum defined on top of
address.h. (i.e. 0 for INET4, 1 for INET6, -1 for both)

Hope this helps,

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the avahi mailing list