[avahi] Bonjour emulation by Avahi on Ubuntu

Gaspard Bucher gaspard at teti.ch
Wed Mar 14 00:49:04 PDT 2012


Avahi can be difficult to grok... I just went through this transition and
it was not easy due to missing docs for low level stuff such as the PollApi.

Here is some advice depending on your situation:

A. You want to avoid creating new threads and use your own select/poll:

You have to create a AvahiWatch and AvahiTimer classes that will insert
file descriptors into your event loop. See poll API for
Qt<http://avahi.sourcearchive.com/documentation/0.6.10/qt-watch_8cpp-source.html>
or
Lua bindings for
lubyk<https://github.com/lubyk/lubyk/tree/master/modules/mdns/core>
(has
both mac and linux code) as examples.

B. You can live with some extra threads:

Use the AvahiThreadedPoll <http://avahi.org/wiki/RunningAvahiClientAsThread> to
run avahi in its own event loop.

C. You use Qt or Glib as event loop: you can use libavahi-qt
and libavahi-glib respectively.

Good luck.

Gaspard

On Tue, Feb 21, 2012 at 1:31 AM, Kirk Reistroffer <kreistroffer at kace.com>wrote:

>  I have a Bonjour-aware service in development and running on OSX and
> Windows.  I'm currently moving it onto Linux flavors and am looking for
> advice on how best to proceed with that.
>
>  It appears that Avahi is a preferred Linux native zeroconf
> implementation and I see that there's been some collaboration between Apple
> and the Avahi project in the past, leading to an Avahi supplied replacement
> dns_sd.h and an avahi-compat-libdns_sd library.  I'm looking for
> information on how to initially make use of the compatibility library.  I'm
> expecting that I'll eventually need to re-implement the zeroconf parts of
> the app to the Avahi API on Linux but hope to more immediately get a Linux
> build that plays well/ok with its peers for POC.
>
>  I haven't yet found a spot on www.avahi.org that describes how to build
> the first step.  I've substituted the Avahi dns_sd.h (which appears to be a
> subset of Apple's dns_sd.h) and link with libavahi-common.so.  I've tried:
>  > sudo apt-get install libavahi-compat-libdnssd1
>  That appears to be a source download and I'm trying to get all of its
> dependencies via ./configure in its avahi-0.6.31 directory. I'm guessing
> that will eventually get me a libavahi-compat-libdnssd1.so to add to my app
> link.
> It seems that the standard Avahi .so's are pre-installed in Ubuntu 11 but
> the compatibility libraries aren't so I think I have to build it locally
> and add it to /usr/lib with the other libavahi-*.so files.  Am I on the
> right track?
>
>
>
> _______________________________________________
> avahi mailing list
> avahi at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/avahi
>
>


-- 

                                                               Gaspard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/avahi/attachments/20120314/6a97da44/attachment.htm>


More information about the avahi mailing list