[sane-devel] More saned stuff: mDNS DNS-SD feature for saned and net backend

Julien BLACHE jb at jblache.org
Fri Apr 11 17:34:41 UTC 2008


For those here not following sane-commits, this just went in:

>     Date: Friday, April 11, 2008 @ 17:18:19
>   Author: jblache

> Add mDNS DNS-SD support to saned and the net backend so they can announce
> and discover each other automatically.
> Optional at configure time, requires Avahi >= 0.6.4.

mDNS and DNS-SD stuff has been discussed a couple times here in the
past years, but nothing really came out of that.

So, last week I did the prerequisite work of turning saned into a
full-fledged daemon and today I completed the Avahi bits for both
saned and the net backend.

You should consider all this stuff as experimental for now, with
pretty much everything being subject to change :-)

Now, for the details:
 - saned announces a service of type _sane-port._tcp
 - the TXT RR contains a single entry, which is "protovers=..."; it's
   the SANE network protocol version implemented by the server, in
   hexadecimal notation, without the leading 0x and without padding,
   32bit value.
 - saned fires up a child process dedicated to maintaining this
   service announcement

 - the net backend fires up a thread dedicated to service discovery as
   one of the first things it does in sane_init(); by the time
   sane_get_devices() is run, hopefully some services have been
 - any server discovered is added to the list, but is never removed
   from the list; the current design of the backend doesn't allow that
   in a safe way

The Avahi support is non-invasive in terms of code and is disabled by
default; if you want to enable it, make sure you have Avahi >= 0.6.4
(the latest 0.6.22 version is recommended) and pass --enable-avahi at
configure time.

You also need to have the Avahi daemon up & running on both the server
and client machines, which in turn requires DBus. saned can only
announce itself when run in standalone or in debug mode.

Hopefully this works well enough that we'll see some deployments soon
:) There may still be some rough edges, so if you spot one, just say
so; patches welcome to fix any such problem :)

I haven't registered the service type & stuff with whoever is in
charge of this; I won't do so until this becomes stable.

Finally, there's more to come on the saned front, but the next big
change will require some more time to develop...

Have fun,


Julien BLACHE                                   <http://www.jblache.org> 
<jb at jblache.org>                                  GPG KeyID 0xF5D65169

More information about the sane-devel mailing list